Question: I have already added the array but I keep getting errors. i am uploading a pic with the error (its methods in array thats creating

 I have already added the array but I keep getting errors.

I have already added the array but I keep getting errors. i am uploading a pic with the error (its methods in array thats creating the error. if the array wasnt there, there was is no issue with the code. I will also upload the original code. please add comments do i know what you guys changed. i am uploading a pic with the error (its methods in array

package Project003;

public class SimulationUsingQueueOfCustomers { /** * main method * @param args the command line arguments */ public static void main(String[] args) { // settings/declarations int currentSecond; // for a specific second in simulation final int MAX_TIME_FOR_SIMULATION = 90*60; // 90 minutes // probability of arrival for a second // based on 20 customers an hour final double PROBABILITY_OF_ARRIVAL = 300.0 / (60*60); final int MAX_TIME_TO_CHECKOUT = 5*60; // maximum time to process "customer" int numCustomersArrived = 0; // counter for number of customers that arrived Server[] regularServer = new Server[10]; //Server regularServer = new Server(); Server expressServer = new Server(); // int totalWaitingTime = 0; // initialize total waiting time

// loop to simulate elapsing time for (currentSecond = 0; currentSecond

if (Math.random()

// 'create' this newCustomer with an estimate of time to take Customer newCustomer = new Customer(currentSecond,( (int) (Math.random()*MAX_TIME_TO_CHECKOUT)) ); // stick this new customer on Server's customerArrivalQueue queue

// display customer's arrival // add it to the array if (newCustomer.getWorkToDoRemaining() 0) { expressServer.serveCustomer(); // mark the 'server' as busy

// accumulate waiting time---note: the time this customer waited is: currentSecond - customerBeingServedArrivalTime totalWaitingTime+=currentSecond - expressServer.currentCustomerArrivalTime();

// display working info System.out.println("Express Server: At " + currentSecond + " started working on customer who arrived at "+ expressServer.currentCustomerArrivalTime() + " -- work remainng is " + expressServer.customerWorkToDoRemaining()); }

if (expressServer.isNotFree()) { // decrement work to do by 1 second expressServer.doWork();

// are we done with customer? if (expressServer.isFree()) { System.out.println("Express Server: At " + currentSecond + " server free!"); } } /* EXPRESS END */ // for this second, is a server free and someone waiting? if (regularServer.isFree() && regularServer.queueSize() > 0) { regularServer.serveCustomer(); // mark the 'server' as busy

// accumulate waiting time---note: the time this customer waited is: currentSecond - customerBeingServedArrivalTime totalWaitingTime+=currentSecond - regularServer.currentCustomerArrivalTime();

// display working info System.out.println("Regular Server: At " + currentSecond + " started working on customer who arrived at "+ regularServer.currentCustomerArrivalTime() + " -- work remainng is " + regularServer.customerWorkToDoRemaining()); }

// for this second, if a server is working on a customer then decrease work to do by 1 second if (regularServer.isNotFree()) { // decrement work to do by 1 second regularServer.doWork();

// are we done with customer? if (regularServer.isFree()) { System.out.println("Regular Server: At " + currentSecond + " server free!"); } }

// for this second, if it is the last second, announce last second of simulation if (currentSecond == (MAX_TIME_FOR_SIMULATION - 1)) { System.out.println("At " + currentSecond + " \t\t\t\t\t\t\tWe are closed"); // Display the number of customers stuck on line (still in Queue) System.out.println("\t\t\t\t\t\t\t\tnumber of customers stuck on line: " + regularServer.queueSize()); } } // for loop end

System.out.println(" At " + currentSecond + " Simulation ended");

// display statistics from simulation

// display number of customers that arrived System.out.println(" " + numCustomersArrived + " customers arrived");

// Display the counter for the number of customers served System.out.println("Number of customers served: " + regularServer.getCustomersServed());

// Display the total wait time that ALL customers served had waiting on line System.out.println("Total Wait Time of customers Served: " + totalWaitingTime);

// Display the average wait time that the customers served had to wait on line System.out.printf("Average Wait Time of customers Served: %,.1f ",((double)totalWaitingTime/regularServer.getCustomersServed()));

// Display the number of customers stuck on line (still in Queue) System.out.println("number of customers stuck on line: " + regularServer.queueSize()); } }

CISY 254 Project 3-Queues Due 7/30/2018 Sum 18 Purpose To get experience working with a Queue of Customer Getting Started Use your Node.java and Queue.java and run SimulationUsingQueueOfCustomers.java. Your output should be similar to the Sample Run without changes -pages 2-3 Changes Express Server Add an express server to handle customers with a 'work to do, value of

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!