Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[JAVA] (a) Min-Heap (1 point) Hospital emergency room assign patient priority base on symptom of the patient. Each patient receives an identity number which prioritizes

[JAVA]

(a) Min-Heap (1 point) Hospital emergency room assign patient priority base on symptom of the patient. Each patient receives an identity number which prioritizes the order of emergency for the patient. The lower the number is, the higher the emergency will be. Use java.util.PriorityQueue to write a java program to create the emergency room registration database. The patient.txt is the input file for patient record. Download patient.txt, Patient.java from Moodle to perform following specifications: (i) Load all records from the input file. (ii) At the end, print the list in assigned priority order.

Patient.java

//******************************************************************* // Patient.java //*******************************************************************

public class Patient { private int id; private String name; private String emergencyCase;

//---------------------------------------------------------------- // Creates a customer with the specified id number. //---------------------------------------------------------------- public Patient (int number, String custName,String er ) { id = number; name = custName; emergencyCase = er; }

//---------------------------------------------------------------- // Returns a string description of this customer. //---------------------------------------------------------------- public String toString() { return "Patient priority id: " + id+" Patient name: "+name+" Symptom: "+emergencyCase; } public String getName() { return name; } public int getId() { return id; } public String getCase() { return emergencyCase; }

}

Patient.txt

10,Sam,Bleeding 02,Carla,Stroke 92,Woody,Flu 11,Diane,High-temperature 32,Norm,Stomach 55,Cliff,Broken-bone 06,Tom,Gun-wounds 22,Kristen,Pregnancy

What the output should look like:

List the input records Patient record : Patient priority id: 10 Patient name: Sam Symptom: Bleeding Patient record : Patient priority id: 2 Patient name: Carla Symptom: Stroke Patient record : Patient priority id: 92 Patient name: Woody Symptom: Flu Patient record : Patient priority id: 11 Patient name: Diane Symptom: High-temperature Patient record : Patient priority id: 32 Patient name: Norm Symptom: Stomach Patient record : Patient priority id: 55 Patient name: Cliff Symptom: Broken-bone Patient record : Patient priority id: 6 Patient name: Tom Symptom: Gun-wounds Patient record : Patient priority id: 22 Patient name: Kristen Symptom: Pregnancy

Priority queue using Comparator: Patient priority id: 2 Patient name: Carla Symptom: Stroke Patient priority id: 6 Patient name: Tom Symptom: Gun-wounds Patient priority id: 10 Patient name: Sam Symptom: Bleeding Patient priority id: 11 Patient name: Diane Symptom: High-temperature Patient priority id: 22 Patient name: Kristen Symptom: Pregnancy Patient priority id: 32 Patient name: Norm Symptom: Stomach Patient priority id: 55 Patient name: Cliff Symptom: Broken-bone Patient priority id: 92 Patient name: Woody Symptom: Flu

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: 3

blur-text-image

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

Databases Illuminated

Authors: Catherine M. Ricardo, Susan D. Urban, Karen C. Davis

4th Edition

1284231585, 978-1284231588

More Books

Students also viewed these Databases questions

Question

What are the pros and cons of credit?

Answered: 1 week ago