Emergency Room Queue using Linked List. I created most of the files but having t
ID: 3829170 • Letter: E
Question
Emergency Room Queue using Linked List. I created most of the files but having trouble with one to complete the code.
package ER;
import java.util.PriorityQueue;
import java.util.Scanner;
import java.io.*;
public class PatientQueue
{
public static void main(String[] args) throws FileNotFoundException
{
File Info = new File("Patient.txt");
Scanner fileinfo = new Scanner(Info);
Scanner scan;
int n;
}
void insert() {
Scanner scan = new Scanner(System.in);
LList queue = new LList();
System.out.println("Patient Name - Disease");
System.out.println("isEmployee 'n' isInsured :");
n = scan.nextInt();
System.out.println("");
for(int i=0; i<n; i++) {
queue.add(scan.nextInt());
}
}
void delete() {
System.out.println(" The Queue");
while(!PatientQueue.isEmpty()) {
System.out.println(PatientQueue.poll());
}
}
private static char[] poll() {
// TODO Auto-generated method stub
return null;
}
private static boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
/*
* Read in Patients & add patients to correct queues
*/
// While(some scanner reads till end)
// {
// read the line, store whats read, create the patient with said info
// Add patient to queue
//substring(0, (name of string that carrys info).indexof(";"); breaks up the string
// logic for passing into correct queue is done here
// (most likeley 3 if statements do determine which queue)
// }
//
/*
* Tell queues to start processing(pushing) patients out of queues
* This is where the timer comes into play
*/
PriorityQueue<Patient> pq = new PriorityQueue<Patient>(){
{
Patient = new Patient("Patient.txt", 2);
pq.add(bob);
while (pq.size() != 0)
{
System.out.println(pq.remove());{
}
}
The code takes a "patient.txt" file that something like this
Leonard Myers;true;true;0
Orville Ink;true;false;0
Francis Pearl;true;true;0
Quiver Dover;true;true;0
Nancy Stevens;true;true;0
Kat Junk;false;true;2
Vicky Arthur;false;true;1
Paul Unger;false;true;1
Where it queue by if the person is an employee at the hospital, then if they insurance, then the severity of the injury.
Myocardial infarction -0
Gushing Artery-1
Cephalalgia-2
The output would sort the patients.
Any help would be great
Explanation / Answer
Please find the remaining code to complete your program
****************************
public void readpatitentsandaddpatitents(){
List<PatientQueue> list=new ArrayList<>();
try {
System.out.print("Enter the file name with extension : ");
Scanner input = new Scanner(System.in);
File file = new File(input.nextLine());
input = new Scanner(file);
while (input.hasNextLine()) {
String line = input.nextLine();
//System.out.println(line);
list.add(input);
if(substring(0,(input).indexof(";"))){
passthevaluesintothequue(Queue<String> queue);
}
}
input.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private static void passthevaluesintothequue();
{
list.add(input);
printQueue(queue);
}
private static void printQueue(Queue<String> queue) {
for(String s: queue){
System.out.print(s + " ");
}
System.out.println();
}
*************************
P.S Kindly add the above code in your program to get the functionallity done
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.