Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Focus: Java Collection Framework In this assignment, you are required to write a menu-driven Java program that allows the user to add patients to a

image text in transcribedimage text in transcribed

Focus: Java Collection Framework In this assignment, you are required to write a menu-driven Java program that allows the user to add patients to a priority queue, displaythe next patient (and remove him/her from the queue), show a list of all patients currently waiting for treatment, and exit the program. The program should simulate the scheduling of patients in a clinic. Use the attached Patient class provided along with this assignment Your program should schedule patients in the queue according to the emergency of their cases from 1 to 5 (the higher the value, the higher the priority). If two patients have the same emergency value, use their order of arrival to set their priority (the lower the order, the higher the priority). It is up to you to have the Patient class implement either Comparable or Comparator Create a class PatientManager that has an attribute named waitingList of the type PriorityQueue Patient and a public method, start When start is called, it should display the following menu of choices to the user, and then ask the user to enter a choice from 1 to 4: (1) New Patien 2) Next Patient (3) Waiting List (4) Exit Here is a description of each choice: (1) Ask the user for the patient's name and the emergency from 1 to 5 (1 ow, and 5 fe and-death). Your program should create an instance of Patient using the entered data and add it to the priority queue. Note that your program should not askthe user for the value of the patient's order of arrival. Instead, it should use a counter that is automatically incremented whenever a patient is added to the queue (2) Display the name of the next patient in the priority queue and remove him/her from the queue (3) Display the full list of all patients that are still in the queue. (4) End the program. Make sure your PatientManager class is robust. It should not crash when a user enters invalid value. Instead, it should display an error message followed by an action depending on the type of error (see the sample run below) Test your program by instantiating your PatientManager class in a main method and calling the start method Note: Add more helper methods and attributes as needed to the PatientManager class

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Knowledge Discovery In Databases

Authors: Gregory Piatetsky-Shapiro, William Frawley

1st Edition

ISBN: 0262660709, 978-0262660709

More Books

Students also viewed these Databases questions

Question

What is the meaning of debtor?

Answered: 1 week ago

Question

What is job costing?

Answered: 1 week ago

Question

4. What actions should Bouleau & Huntley take now?

Answered: 1 week ago