LAB211 Assignment: Title Background Program Specifications
LAB211 Assignment: Title Background Program Specifications
Title
Doctor management program.
Background
N/A
Program Specifications
Write a program to manage the doctor information below:
Display the menu:
1. Add Doctor
2. Update Doctor.
3. Delete Doctor
4. Search Doctor.
5. Exit.
- If the user chooses 1 then add one record to data including Code(String), Name(String), Specialization(String),
Availability(int).
- If user chooses 2: then request enter the code. If it does not exist Code, the notification "Doctor code does not
exist". Otherwise user can edit of the remaining information. If Information is blank then not change old
information.
- If user chooses 3: the Code requires the user to enter Code and delete information if Code exists, if Code does not
exist,, the notification "code does not exist Doctor".
- If user chooses 4: require user to enter search strings, search and returns the list for users.
Function details:
Function 1: Display GUI and Input Data.
User runs the program. The program prompts users input Data.
1 2
========= Doctor Management ========== --------- Add Doctor ----------
Add Doctor Enter Code:
Update Doctor Enter Name:
Delete Doctor Enter Specialization: Enter
Search Doctor Availability:
Exit
3
--------- Update Doctor -------
Enter Code:
Enter Name:
Enter Specialization: Enter
Availability:
4
--------- Delete Doctor -------
Enter Code:
5
---------- Search Doctor --------
Enter text:
--------- Result ------------
Code Name Specialization Availability
DOC 1 Nghia Orthopedics 3
DOC 2PhuongObstetrics 2
DOC 3 Lien orthodontic 1
Guidelines
Student must implement methods
- addDoctor
- updateDoctor
- deleteDoctor
- searchDoctor
in startup code.
Suggestion:
Class DoctorHash contains adding, editing, deleting and searching functions with doctor information. Rewrite above
function and rewrite “checkAvailability function” to check the validation of Availability, know that Availability> = 0.
Use the Throw function to output the exceptions in the functional requirements
Use the Put function to add an element into HashMap
Use the update function to replace or put HashMap
Use the delete function to remove an element in the HashMap.
Use the value of HashMap to get the values and then use the Foreach Code, Name .... then use the “contains function”
to find the value.
Function 1: Add a doctor
o Implement function: public boolean add Doctor (Doctor Doctor) throws Exception
Input:
Return Value:
Exception ("Database does not exist") case was null HashMap information
Exception ("Data does not exist") If the parameters are null doctor.
Input:
Return Value:
Exception ("Database does not exist") case was null HashMap information
Return Value:
Exception ("Database does not exist") case was null HashMap information
Input:
Return value:
Exception ("Database does not exist") case was null HashMap information