CSE205 Assignment #11 Solved

50.00 $

Category: Tags: , , ,

Description

5/5 - (1 vote)

Program Description

In the Assignment #11, you will be implementing a Patient Management System. You can assign each patient to one of the three queues, High Priority Queue, Intermediate Queue, or Delayed Care Queue, depending on each patient’s condition level. A number of available doctors will be specified by a user at the beginning, and a patient from queues can be assigned to a doctor with no patient at that time. Once a patient is released from its doctor, then the patient should be added to the Check Out Queue. Patients in the Check Out Queue can be checked out one by on. Each patient will be identified by its patient id, and each doctor will be identified by its doctor id.

Patient class

This class is already defined. Each Patient has its patientlD (int) and conditionLevel (String) (one of HighPriority, Intermediate, DelayedCare). Its getPatientID( ), getConditionLevel( ), and toString( ) method are defined in the class.

Doctor class

Each doctor has its doctorlD (int), and currentPatient (a reference variable of Patient class). One patient can be assigned to a doctor at a time. currentPatient should be null when no patient is assigned to the doctor. Its constructor and toString( ) method are already defined. You will need to define the following additional methods:

public boolean hasPatient()

If the doctor has an assigned patient, then it should return true. Otherwise, it should return false.

public boolean assignPatient(Patient patient])

If the doctor does not have any assigned patient, assign the parameter patient] to its currentPatient and return true, otherwise return false;

Patient releasePatient()

If the doctor has and assigned patient, it should set its currentPatient to null, but it also needs to return the Patient object that was assigned as its currentPatient. Otherwise, it should return null.

PatientManagement class

This class keeps track of four queues, highPriorityQueue, intermediateQueue, delayedCareQueue, and checkOutQueue. They should not contain anything at the beginning, but they can eventually contain Patient objects. The first there queues are waiting list queues for patients depending on their condition level. The last queue, checkOutQueue is for patients who have already been released from their doctor, to check out. This class also contains an array of Doctor objects. A number of doctors should be specified by a user before PatientManagement object is created. Its constructor and printQueues( ) method are already defined. You need to defined the following additional methods:

boolean addPatient(int patientID, String conditionLevel)

This method attempts to add a patient of the parameter patientlD and conditionLevel to its corresponding queue. If the parameter conditionLevel is “High Priority”, then instantiate a Patient object using its id and conditionLevel, and add it to the highPriorityQueue. If the parameter conditionLevel is “Intermediate”, then instantiate a Patient object using its id and conditionLevel, and add it to the intermediateQueue. If the parameter conditionLevel is “Delayed Care”, then instantiate a Patient object using its id and conditionLevel, and add it to the delayedCareQueue. For those three cases, it should return true. If the conditionLevel is none of these three, it should not add a Patient object to any queue, and it should return false.

 

 

Patient assignPatientToDoctor()

This method needs to check if there is any patient in the highPriorityQueue, and if there is, it tries to assign the patient to a doctor. If there is no such patient, then it should check if there is any patient in the intermediateQueue, if not, it should check if there is any patient in the delayedCareQueue. Thus you need to find a next patient using their condition level, and within a same condition level, whoever was added to the queue first. Then you need to check each doctor to see who does not have any patient at that time, in the order of their doctorIDs, 0, 1, … through the last index of the doctor array. Once you find such an available doctor, then assign the patient that you have obtained from one of the three queues to the doctor, and return the Patient object. If there is no doctor available or no patient in any of the three waiting queues, then it should return null.

Patient releasePatientFromDoctorToCheckOutQueue(int doctorlD)

This method should check if the doctor of the give parameter doctorlD has any patient and if it has, release that patient (use a method of the Doctor class), and add that patient into the checkOutQueue, and return the released Patient object. If the doctor of the given parameter doctorlD does not have any patient or the

parameter doctorlD is not valid (not within the range of the doctor array), it should return null.

Patient checkOutPatient()

If the checkOutQueue is not empty, this method should remove the next patient from the queue and return it. Otherwise, it should return null.

Test your PatientManagement class with the given Assignment11.java file.

Test Cases

Download the following input files, input1.bd, input2.txt, input3.txt, and input4.txt, and the following output files, output1.bd, output2.txt, output3.txt, and output4, and save them in the same directory as Assignment11.java is located.

inputl .bct  (https://asu.instructure.com/courses/42647/files/14147286/download? wrap=1)_

 

fhttps://asu.instructure.com/courses/42647/files/14147286/download?  wrap=1),

input2.txt

(https://asu.instructure.com/courses/42647/files/14147287/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147287/download? wrap=1)_

input3.txt

(https://asu.instructure.com/courses/42647/files/14147289/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147289/download? wrap=1)

input4.txt

(https://asu.instructure.com/courses/42647/files/14147291/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147291/download? wrap=1)

outputl .txt

(https://asu.instructure.com/courses/42647/files/14147292/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147292/download? wrap=1)_

output2.txt

(https://asu.instructure.com/courses/42647/files/14147294/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147294/download? wrap=1)_

output3.txt

(https://asu.instructure.com/courses/42647/files/14147295/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147295/download? wrap=1)_

output4.txt

(https://asu.instructure.com/courses/42647/files/14147296/download? wrap=1)_

(https://asu.instructure.com/courses/42647/files/14147296/download? wrap=1)_

Error Handling

Your program should be robust enough to handle all test cases above.

What to turn in:

-Submit your Assignment11.java, PatientManagement.java, Doctor.java, and Patient.java files

 

  • Assignment11-znu4i9.zip