Best writers. Best papers. Let professionals take care of your academic papers

Order a similar paper and get 15% discount on your first order with us
Use the following coupon "FIRST15"
ORDER NOW

I have completed 90% of the program, but I am having trouble with sorting the LinkedList. I need to use

I have completed 90% of the program, but I am having trouble with sorting the LinkedList. I need to use

the compareTo method I created in order to sort my LinkedList by priority. There are several stipulations listed in the instructions below. (Please use the program I created in the attachment).

  • Suppose there is a hospital with a waiting room filled with several patients. Patients are prioritized based on how severe their casualities are. For instance, car crash andgun shot patients are priority level 1, so they go straight to the front of the queue. Patients with heavy chest pain or mild heart attacks are priority level 2, and so on.
  • Create a hospital that manages patients in a list. Implement it using the LinkedList API. (You may import ArrayList or List, but please do not import any other packages.) See Base_A11Q2.java for a starting place. In particular, see the HospitalADT interface which contains a description of the methods required in the to do list. Create a Patient class that implements Comparable and contains the name of the patient, the casualty of the patient, and the priority level. Make getters and a compareTo method that passes in another Patient and compares the priority levels of the patients. This method should compare the priority levels of the patients and return -1 if the first patient has a lower priority level than the second patient, 0 if the priority levels of the patients are equal, and 1 if the patient has a higher priority level than the second patient.
  • All patients are added into the hospital list. The highest priority task in a to do list is the task with the lowest priority level. When removing patients, your hospital list should return the lowest priority patient. Patients should be removed from the queue when a doctor lets each patient in for examination.
 
Looking for a Similar Assignment? Order now and Get 10% Discount! Use Coupon Code "Newclient"