Question: finish up the code below so it runs as so: Customers in a Queue Simulation! How many service areas? 4 How long, in minutes, should

finish up the code below so it runs as so: Customers in a Queue Simulation!
How many service areas? 4
How long, in minutes, should the simulation run? 60
Total customers served =33
Average wait time =9.6
Longest wait time =16
Longest queue =11 this is the code so far: import java.util.*;
import java.io.*;
public class CustomersInQueue
{
public static final double CHANCE_OF_CUSTOMER =0.8; //
public static void outfileServiceAreasAndQueue(PrintWriter outfile, int min, Customer[] atServiceWindow, Queue queue)
{
outfile.print(min +": ");
for(Customer c : atServiceWindow)
if( c != null )
outfile.print(c.toString()+"");
outfile.println(""+ queue);
}
public static double calculateAverage(int totalMinutes, int customers)
{
return (int)(1.0* totalMinutes/customers *10)/10.0;
}
public static PrintWriter setUpFile()
{
PrintWriter outfile = null;
try
{
outfile = new PrintWriter(new FileWriter("customersSimulation.txt"));
}
catch(IOException e)
{
System.out.println("File not created");
System.exit(0);
}
return outfile;
}
public static void main(String[] args)
{
PrintWriter outfile = setUpFile();
System.out.println("Customers in a Queue Simulation! ");
Scanner kb = new Scanner(System.in);
System.out.print("How many service areas? ");
int sa = kb.nextInt();
System.out.print("How long, in minutes, should the simulation run? ");
int time = kb.nextInt();
serveTheCustomers(time, sa, outfile); //run the simulation
}
public static void serveTheCustomers(int time, int number_of_serviceAreas, PrintWriter outfile)
{
/***************************************
call outfileTimeAndQueue() to store the queue to the file.
**********************************/
}
static class Customer
{
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!