Algorithms and data Structures
Assessment Background/Scenario
The Accident & Emergency (A&E) Department of a private hospital needs an application for managing patients (allocating doctors based on initial check-up and producing reports). A&E regularly provides support to the patients. The initial check-up is done by a nurse who then enters the basic information into the system, such as: required doctor’s speciality depending on the medical condition and a fee based on the expected treatment. The system then allocates a doctor and generates reports based on the patients’ ages as distributed in the different bands – see Table 3.
Table 1: Sample hospital data
Patient ID First Name Last Name Age Treatment cost Speciality Doctor’s
Name
1 Georgia Roberts 23 £350 Cardiovascular James
2 Charlie Smith 40 £450 Dermatology Richard
3 Mariam Dawson 27 £600 Cardiovascular James
4 Emmett Miller 30 £800 Cardiovascular James
5 Lily Taylor 18 £950 Dermatology Richard
6 Bill Harley 70 £1050 Orthopedics Peter
Table 2: Sample data – Doctor’s speciality
ID Doctor’s Name Speciality
1 James Cardiovascular
2 Richard Dermatology
3 Peter Orthopedics
Table 3: Sample data distributed by age
ID Band
1 0-18
2 19-45
3 46-above
Assessment Tasks
Design and build an application that requires the user to input the patient data via the console/command line (assume that nurses have done the initial check-up of the patient) and store it in an appropriate internal structure.
There is no requirement for this data to be preserved after the application is closed.
You will need to consider what the application outputs to the user to demonstrate the results of each task below.
You should provide the user with a means to close the program once operations are complete.
Your application should be able to perform the following tasks as given in Section 2 (Scenario):
Task A: Write pseudocode algorithms for the tasks given below.
Take user input data (i.e. name, age, treatment cost and speciality) based on initial check-up and store it in an appropriate data structure. Sample data is provided in Table 1.
Store doctor speciality data in an appropriate data structure. Sample data is provided in Table 2.
Generate the sample report to count how many patients each doctor has seen, as given in Table 4 below.
Table 4: Patient allocation
ID Doctor’s Name Allocated Patient
1 James 3
2 Richard 2
3 Peter 1
Sort all patients by treatment cost (highest cost first)
Sort all patients by their last name.
Calculate cost of treatment for each age band, based on Table 3.
Table 5: Sample cost of treatment based on age band
Band Total no. of patients Total amount
0-18 1 £950
19-45 4 £2200
46-above 1 £1050
6. Search and identify the patient who has paid the highest treatment cost as given in Table 6
Table 6: Sample patient data – highest treatment cost
Patient ID First Name Last Name Age Treatment cost Speciality Doctor’s
Name
6 Bill Harley 70 £1050 Orthopedics Peter
7. Search and identify the patient who has paid the lowest treatment cost as given in Table 7.
Table 7: Sample patient data – lowest treatment cost
Patient ID First Name Last Name Age Treatment cost Speciality Doctor’s
Name
1 Georgia Roberts 23 £350 Cardiovascular James
Task B: Construct the application and implement algorithms.
Develop a single Java program that follows coding conventions and enables the user to: store, search, and sort patients.
Implement all the algorithms you have created for Task A.
Note:
You need to ensure that the user input is validated, and feedback is given when an invalid input is entered.
Ensure that a single Java file named “AEDepartment.java” can be compiled and run from the command/console line.
Test all the implemented algorithms you have created for Task A.