Recent disasters (e.g., hurricanes, earthquakes) and attacks (e.g., shooting) can suddenly increase the number of patients seeking help at emergency rooms. Emergency rooms have plans to prepare for the influx. How would you design a system that can handle the influx efficiently?
The goal of HW4 is to design and implement a system that can efficiently handle the influx of patients at an emergency room. One plan is to triage patients, where patients are prioritized by their level of severity. Some patients might need to be treated immediately, while some others can be delayed. Also, over time, conditions of a patient can deteriorate or improve.
Consider Emergency Severity Index (ESI) that ranges from 1 (resusitation) to 5 (nonurgent). For simplicity, the number of minutes needed for a doctor to treat a patient is 2(6−esi).
Initially, the emergency room has two available doctors (Alice and Bob), more doctors may arrive and become available. Furthermore, assume the patient departs after treatment (discharged or admitted to the hospital for further treatment). A patient might also depart after treatment from a nurse instead of a doctor. When two patients have the same ESI, the patient who arrives earlier will be treated first. Time stamps are unique.
To efficiently decide which patient each doctor is going to treat, you will use HeapAdaptablePriorityQueue (textbook). You may modify HeapAdaptablePriorityQueue and related classes to increase their general functionality.
Input: The command-line argument for HW4.java is the name of the input file, which has one of the following possible events on each line:
patientArrives time patient esi
updatePatientESI time patient newEsi
patientDepartsAfterNurseTreatment time patient
doctorArrives time doctor
time is in HHMM format, where HH ranges from 00 to 23 and MM ranges from 00 to 59 (leading zeros are optional).
Input 1.txt
patientArrives 1110 Alex 2
patientArrives 1111 John 3
patientArrives 1112 Chad 5
patientArrives 1113 Sharron 1
patientArrives 1114 Kelcey 3
updatePatientESI 1122 Chad 2
patientDepartsAfterNurseTreatment 1135 Kelcey
Output2.txt
patientArrives 1110 Alex 5
patientArrives 1111 John 1
patientArrives 1112 Chad 5
patientArrives 1113 Sharron 3
patientArrives 1114 Kelcey 4
patientArrives 1115 Hal 2
patientArrives 1116 Abbie 4
patientArrives 1117 Jerald 4
patientArrives 1118 Emily 3
patientArrives 1119 Leo 2
updatePatientESI 1120 Hal 5
patientArrives 1120 Shawn 5
patientArrives 1121 Mike 3
patientDepartsAfterNurseTreatment 1122 Shawn
patientArrives 1122 Andrew 3
patientDepartsAfterNurseTreatment 1123 Emily
patientArrives 1123 Carl 3
patientDepartsAfterNurseTreatment 1124 Mike
patientArrives 1124 Jessica 5
patientDepartsAfterNurseTreatment 1125 Carl
doctorArrives 1125 Carol
patientDepartsAfterNurseTreatment 1130 Abbie
updatePatientESI 1131 Kelcey 3
patientDepartsAfterNurseTreatment 1139 Hal
updatePatientESI 1140 Jessica 4
Output: Output goes to the standard output (screen):
patientArrives time patient esi
updatePatientESI time patient newEsi
patientDepartsAfterNurseTreatment time patient
doctorArrives time doctor
doctorStartsTreatingPatient time doctor patient
doctorFinishesTreatmentAndPatientDeparts time doctor patient
Output 1
patientArrives 1110 Alex 2
doctorStartsTreatingPatient 1110 Alice Alex
patientArrives 1111 John 3
doctorStartsTreatingPatient 1111 Bob John
patientArrives 1112 Chad 5
patientArrives 1113 Sharron 1
patientArrives 1114 Kelcey 3
doctorFinishesTreatmentAndPatientDeparts 1119 Bob John
doctorStartsTreatingPatient 1119 Bob Sharron
updatePatientESI 1122 Chad 2
doctorFinishesTreatmentAndPatientDeparts 1126 Alice Alex
doctorStartsTreatingPatient 1126 Alice Chad
patientDepartsAfterNurseTreatment 1135 Kelcey
doctorFinishesTreatmentAndPatientDeparts 1142 Alice Chad
doctorFinishesTreatmentAndPatientDeparts 1151 Bob Sharron
Output 2
patientArrives 1110 Alex 5
doctorStartsTreatingPatient 1110 Alice Alex
patientArrives 1111 John 1
doctorStartsTreatingPatient 1111 Bob John
patientArrives 1112 Chad 5
doctorFinishesTreatmentAndPatientDeparts 1112 Alice Alex
doctorStartsTreatingPatient 1112 Alice Chad
patientArrives 1113 Sharron 3
patientArrives 1114 Kelcey 4
doctorFinishesTreatmentAndPatientDeparts 1114 Alice Chad
doctorStartsTreatingPatient 1114 Alice Sharron
patientArrives 1115 Hal 2
patientArrives 1116 Abbie 4
patientArrives 1117 Jerald 4
patientArrives 1118 Emily 3
patientArrives 1119 Leo 2
updatePatientESI 1120 Hal 5
patientArrives 1120 Shawn 5
patientArrives 1121 Mike 3
patientDepartsAfterNurseTreatment 1122 Shawn
patientArrives 1122 Andrew 3
doctorFinishesTreatmentAndPatientDeparts 1122 Alice Sharron
doctorStartsTreatingPatient 1122 Alice Leo
patientDepartsAfterNurseTreatment 1123 Emily
patientArrives 1123 Carl 3
patientDepartsAfterNurseTreatment 1124 Mike
patientArrives 1124 Jessica 5
patientDepartsAfterNurseTreatment 1125 Carl
doctorArrives 1125 Carol
doctorStartsTreatingPatient 1125 Carol Andrew
patientDepartsAfterNurseTreatment 1130 Abbie
updatePatientESI 1131 Kelcey 3
doctorFinishesTreatmentAndPatientDeparts 1133 Carol Andrew
doctorStartsTreatingPatient 1133 Carol Kelcey
doctorFinishesTreatmentAndPatientDeparts 1138 Alice Leo
doctorStartsTreatingPatient 1138 Alice Jerald
patientDepartsAfterNurseTreatment 1139 Hal
updatePatientESI 1140 Jessica 4
doctorFinishesTreatmentAndPatientDeparts 1141 Carol Kelcey
doctorStartsTreatingPatient 1141 Carol Jessica
doctorFinishesTreatmentAndPatientDeparts 1142 Alice Jerald
doctorFinishesTreatmentAndPatientDeparts 1143 Bob John
doctorFinishesTreatmentAndPatientDeparts 1145 Carol Jessica
Submission: Submit HW4.java that has the main method, (modified) HeapAdaptablePriorityQueue.java and related classes, and other program files. Submissions for Individual and GroupHelp have the same guidelines as HW1.
Contact us for this Java assignment Solutions by Codersarts Specialist who can help you mentor and guide for such Java programming assignments.
We also provide help in Java assignment , homework, Coursework, final year mini - project, major project and development work help. contact us now at contact@codersarts.com and get in touch with our team of Java experts
Comments