Write a class Patient that identifies a patient in an emergencyroom. Each patient object has two
instance variables: a string representing their name, and anunsigned integer representing the
severity of their condition. The user interface should providethe following three options:
1) Add patient
2) Treat patient
When a patient is added, the user should be given a promptasking first for the patient’s name and
then for the severity of their condition. If the user entersanything other than a positive whole
number for the severity, you must prompt the user again. Afterthe user enters a patient name and
severity, you must re-display the initial prompt.
When a patient is treated, you must remove the patient with thehighest severity from the queue.
You must print “name of patient successfully treated!” and thenre-display the initial prompt. If
there are no patients in the queue when you try to treat apatient, you must print a message saying
“No patients remaining!” and re-display the initial prompt.
The program should exit when the user selects the quit option. Ishould not be able to cause your
program to crash simply by providing it with bad input. You maynot use the PriorityQueue
class from java.util for this — the point is to write your ownpriority queue.
Answer to Using Java Emergency Room Write a class Patient that identifies a patient in an emergency room. Each patient object has …