Question
Create a JAVA program that will: Apply priority queues Apply triage in a hospital emergency room Write a simulator that will simulate a triage situation,
Create a JAVA program that will:
Apply priority queues
Apply triage in a hospital emergency room
Write a simulator that will simulate a triage situation, taking input from file. In the file, use the following format:
FName LName TriageCode
Where FName is the patients first name, LName is the patients last name, and TriageCode is a two letter code indicating the injury or illness. To determine the meaning of the code or the severity of the illness or injury in terms of degree of pain or threat to survival, use the following chart (which includes the priority from 1 to 3, 1 being the most urgent):
Code : AL Meaning: Amputated limb or digit priority: 1
Code : HA Meaning: Heart attack priority: 1
Code : ST Meaning: Stroke priority: 1
Code : BL Meaning: Broken leg priority: 2
Code : IW Meaning: Infected wound (abscess) priority: 2
Code : KS Meaning: Kidney stones priority: 2
Code : OT Meaning: Other/Unknown priority: 2
Code : HN Meaning: Hangnail priority: 3
An actual file might look something like the following:
John Jenkins HA
Bob Snaggle BL
Debra Brown HA
Shelly Snugglefuss HN
Marcus Sawzaw AL
Patricia Prunejuse OT
Karl Kidnasty KS
Ralph Renalpayne KS
There are a multitude of ways to implement a priority queue. This implementation uses 3 regular queues:
o You should create a class, TriageSimulator, which should maintain three (3) regular queues (using your own custom implementation of Queue or another that you find or like) one for each of the 3 priority levels.
You must implement the following methods:
o add(string lineFromFile) and doesnt return anything
o remove() which returns the name of the next patient to be seen, and removes him/her from the appropriate queue
o isEmpty() which returns a boolean, indicating that all three queues are empty
You must create an instance of your TriageSimulator and use it from another class, which will contain the main method
To ensure understanding, the actual file shown earlier would be read into memory somewhere in a method called by main (or in main itself) and should simply call the add( ) method on the lines read from file, one at a time. TriageSimulator is responsible for parsing and making sense of the names and codes in the file, placing the names (not the conditions) in the appropriate queue.
If remove() is called, it should return the next person who will be seen by a doctor or NP and remove that person from the appropriate queue. Note that this is transparent to the calling method. In other words, main() or anything in that class should not have to worry about which queue names are stored in.
Regardless of the order that the names were added to the queues, if there is anyone in the priority 1 queue, their name comes first even if they were the last person to come into the emergency room. If priority 1 queue is empty, priority queue 2 is checked, and only when it is empty, priority queue 3 will be checked.
Run your program and make sure all the parts work.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started