Section A

ABC College is a local education provider that specialises in software development, information
management, and mobile application development training. The educational provider has
recently opened a college in your town and has hired the software development house you work
for to design a Java application to manage their students.
Your line manager has requested you develop the application with the following requirements:
1.1. When the application starts, it must display the following menu structure:
STUDENT MANAGEMENT APPLICATION
*************************************************
Please enter (1) to launch menu or any other key to exit
if 1 is chosen
Please select one of the menu items:
(1) capture a new student
(2) Search for a student
(3) delete a student
(4) print a student report
(5) exit application
1.2. If the user selects to capture a new student, you must save all the information supplied by
the user to memory. use arrays or array lists to save the student model to achieve
this.
Sample Capture Student Screen Shot:
CAPTURE A NEW STUDENT
***********************************
Enter the student ID: 34256
Enter student name: tarishka
enter student age: 19
enter student email:tqriwyi
enter student course: disd
Enter (1) to launch menu or any other key to exit
1.3. If the user enters an incorrect student age, prompt the user to re-enter a valid one. A valid
student age is any age greater than or equal to 16. Only numbers are allowed to be
supplied when entering a student’s age:
Enter student age: c
You have entered the incorrect student age!!!!
please re-enter the student age >>
Sample Screen Shot of an invalid age:
Enter student age: 10
You have entered the incorrect student age!!!!
please re-enter the student age >>
1.4. Once the entire submission has been completed, the user must be informed that the
student details have been successfully saved.
1.5. The user must have the ability to search for a student. The user will select menu item two,
which will prompt the user to enter a student ID. If a student is found in the application,
display the student’s details to the user. If no student is found, display an error message to
the user that the student cannot be located.

Sample Student Search Screen Shot:
Enter student ID to search:34256
---------------------------------------------
student ID: 34256
student name: tarishka
student age: 19
student email:tqriwyi
student course: disd
-------------------------------------------------
Enter (1) to launch menu or any other key to exit

Sample Invalid Student Screen Shot:
Enter the student ID to Search: 55555
------------------------------------------------------
Student with ID: 55555 was NOT found!!!
------------------------------------------------------
Enter (1) to launch menu or any other key to exit

1.6. The user must have the option to delete a student that has been saved. The user must first
enter the student ID to be deleted. The user must confirm whether they want to delete the
student.
Enter student ID to delete :34256
Are you sure you want to delete Student 34256 from the system?
Yes (y) to delete: y
----------------------------------------------------------------------------------------
Student with student ID: 34256 WAS deleted!!!!!
----------------------------------------------------------------------------------------
Enter (1) to launch menu or any other key to exit
1.7. When the user selects to view the student report, display the report below, which is
generated from the memory collection in your application.

Sample Report Screen Shot:
STUDENT 1
-------------------------------------------
student ID: 34256
student name: tarishka
student age: 19
student email:tqriwyi
student course: disd
---------------------------------------------
STUDENT 2
---------------------------------------------
student ID: 67879
student name: sam
student age: 19
student email:yy38798
student course: djjkd
----------------------------------------------
Enter (1) to launch menu or any other key to exit
1.8. Finally, provide the ability for the user to exit the application.
Additional Requirements:
1.9. In your solution, you are required to create a class called Student which will contain all your
working methods.
1.10. This class will, as a minimum, contain the following methods, but you are encouraged to
add more methods:
• SaveStudent();
• SearchStudent();
• DeleteStudent();
• StudentReport();
• ExitStudentApplication ();
1.11. Create a main class to run your application.

Section B
Your line manager has instructed you to write unit tests to determine the code coverage in the
student management application. You are required to create a test package within the application
you created in the above code, which will contain the required unit tests.
You are required to write the following unit tests:
Test Name: TestSaveStudent()
Test Purpose:To supply the student ID, name, age, email,
and course to the save student method. The
test will determine whether the correct
student will be saved to memory

Test Name: TestSearchStudent ()
Test Purpose: To supply the student id to the search
student method. The test will determine
that the correct student details have been
returned.

Test Name: TestSearchStudent_StudentNotFound()
Test Purpose: To supply an incorrect student ID to the
search student method. The test will
determine that no student was found.

Test Name: TestDeleteStudent()
Test Purpose: To supply the student ID to the delete
student method. The test will determine
that the student has been successfully
deleted.

Test Name: TestDeleteStudent_StudentNotFound()
Test Purpose: To supply an incorrect student ID to the
delete student method. The test will
determine that no student could be found to
delete

Test Name: TestStudentAge_StudentAgeValid()
Test Purpose: To supply a valid student age to the student
age method. The test will determine that the
student’s age is valid.

Test Name: TestStudentAge_StudentAgeInvalid()
Test Purpose: To supply an invalid student age to the
student age method. The test will determine
that the student’s age is less than 16

Test Name: TestStudentAge_StudentAgeInvalidCharacter()
Test Purpose: To supply an invalid character to the student
age method. The test will determine that the
student age supplied is not a number

and prompt the user to re-enter a valid age.

Test Name: TestStudentReport()
Test Purpose: To test the generation of the student report from the memory collection in the application. The test will determine whether the report is displayed correctly.

Test Name: TestExitStudentApplication()
Test Purpose: To test the exit functionality of the application. The test will determine whether the application successfully exits when the user selects to exit.

Note: The above test cases are just examples and may not cover all possible scenarios. It is important to create additional test cases to ensure comprehensive code coverage.

In addition to writing the unit tests, it is recommended to use a testing framework such as JUnit to automate the execution of the tests and generate test reports.

To meet the requirements given in the question, here is a step-by-step guide on how to develop the Java application for student management:

Section A:

Step 1: Create a class called "Student" which will contain all the working methods.
- This class should have methods like SaveStudent(), SearchStudent(), DeleteStudent(), StudentReport(), and ExitStudentApplication().

Step 2: Inside the main class, create a method to display the menu structure and get the user's input.
- Display the menu with the required options.
- Get the user's input and perform the appropriate action based on the selected option.

Step 3: Implement the "capture a new student" functionality.
- If the user selects option 1, prompt the user to enter the student details (ID, name, age, email, and course).
- Validate the student's age to ensure it is greater than or equal to 16.
- Save the student details into memory using arrays or ArrayLists.

Step 4: Implement the student search functionality.
- If the user selects option 2, prompt the user to enter a student ID to search.
- Check if a student with the given ID exists in the application.
- If found, display the student's details.
- If not found, display an error message.

Step 5: Implement the student deletion functionality.
- If the user selects option 3, prompt the user to enter a student ID to delete.
- Confirm with the user if they want to delete the student.
- If confirmed, delete the student from the system.
- Display a success message.

Step 6: Implement the student report functionality.
- If the user selects option 4, display the report generated from the memory collection in your application.
- Display each student's details.

Step 7: Implement the exit functionality.
- If the user selects option 5, exit the application.

Step 8: Create the required unit tests in a separate test package.
- Create unit tests for each of the required test cases mentioned above.
- Ensure that all the methods in the Student class are properly tested.
- Verify the correctness of the save, search, and delete operations.
- Test the validation and error handling based on input.

Step 9: Run the application and perform testing.
- Make sure all the functionality mentioned in the requirements is working as expected.
- Use the unit tests to validate the application's behavior.

That's it! Follow these steps to develop the Java application for student management and to write the required unit tests.

To develop the student management application with the mentioned requirements, you would follow these steps:

1. Create a class called "Student" that contains the following methods: SaveStudent(), SearchStudent(), DeleteStudent(), StudentReport(), and ExitStudentApplication().

2. In the SaveStudent() method, use arrays or array lists to save the student model provided by the user. Prompt the user to enter the student ID, name, age, email, and course. Save these details to memory.

3. Validate the student age input using a loop. If the user enters an incorrect student age (less than 16 or a non-number value), prompt them to re-enter a valid age.

4. After the user completes the submission, inform them that the student details have been successfully saved.

5. In the SearchStudent() method, prompt the user to enter a student ID and search for the corresponding student in the saved data. If found, display the student's details. If not found, display an error message.

6. In the DeleteStudent() method, prompt the user to enter a student ID and confirm whether they want to delete the student. If confirmed, delete the student from the saved data and inform the user. If not confirmed or if the student is not found, display an appropriate message.

7. In the StudentReport() method, display a report generated from the memory collection in your application, showing all the saved student details.

8. Implement an ExitStudentApplication() method to allow the user to exit the application.

9. Create a main class to run the application, where you can interact with the menu and call the respective methods based on the user's selection.

For Section B, to write the unit tests for the student management application:

1. Create a test package within your application.

2. Write unit tests for each of the methods in the Student class:

- TestSaveStudent(): Test that supplies the student ID, name, age, email, and course to the SaveStudent() method and determines whether the correct student is saved to memory.

- TestSearchStudent(): Test that supplies the student ID to the SearchStudent() method and determines that the correct student details are returned.

- TestSearchStudent_StudentNotFound(): Test that supplies an incorrect student ID to the SearchStudent() method and determines that no student was found.

- TestDeleteStudent(): Test that supplies the student ID to the DeleteStudent() method and determines that the student has been successfully deleted.

- TestDeleteStudent_StudentNotFound(): Test that supplies an incorrect student ID to the DeleteStudent() method and determines that no student was found to delete.

- TestStudentAge_StudentAgeValid(): Test that supplies a valid student age to the StudentAge() method and determines that the student's age is valid.

- TestStudentAge_StudentAgeInvalid(): Test that supplies an invalid student age (less than 16) to the StudentAge() method and determines that the student's age is less than 16.

- TestStudentAge_StudentAgeInvalidCharacter(): Test that supplies an invalid character to the StudentAge() method and determines that the student age supplied is not a number.

3. Run the unit tests to determine the code coverage and ensure the application functions as expected.

By following these steps, you can develop the student management application and write the necessary unit tests to ensure its proper functioning.