Question: In this assignment, you will demonstrate your understanding of using several JCF classes and implement a simulation. The simulation will be of a bank with




In this assignment, you will demonstrate your understanding of using several JCF classes and implement a simulation. The simulation will be of a bank with some number of tellers whereby random customers will enter the bank, stand in line and then be serviced. The goal of the simulation is to compute the average and maximum wait times of the customers. You will compare your results by using a queue, stack, and priority queue for your line Your first step is to implement a queue class using a LinkedList. A version has been posted under the sample programs for module 6 called MyQueue (if you prefer, you can use MyQueue2). Re-implement whichever class you prefer from scratch to get the experience in seeing how to take a LinkedList and make it into a Queue. Your Queue class should be generic and have one instance datum, the queue itself, which will be of type LinkedList. Your Queue class needs a no-arg constructor to initialize the LinkedList object to null and methods of enqueue, dequeue and isEmpty. You can implement peek but you will not need it in this assignment. After compiling your Queue class, move on to a Customer class (NOTE: in lecture, I said that you would be storing Integer objects, but I misspoke create a separate class called Customer). This class will have two instance data: entryTime and serviceTime, both int values. Use a 2-arg constructor and have accessors for both methods. Have Customer implement Comparable (this is required for the PriorityQueue). The compareTo method will work as follows If this Customer's serviceTime-other Customer's serviceTime then return this Customer's entryTime other Customer's entryTime else return this Customer's serviceTime other Customer's serviceTime The idea here is that the Customer with the shortest serviceTime will be the first returned by the PriorityQueue, and on a tie, it is broken by the Customer with the earliest entryTime. If there is still a tie we don't care because the two Customers are virtually identical with respect to how the simulation treats them. This will be used to implement the "shortest job first" version of the PriorityQueue. You will also implement a "longest job first" which will use the exact same simulation code but the Customer's compareTo will be altered to return the two subtractions in the opposite order (that is, other Customer's entryTime -this Customer's entryTime and other Customer's serviceTime -this Customer's serviceTime) The simulation class will contain two objects, a line that is either a MyQueue Customer Stack or PriorityQueue and a Random to get random numbers. Your simulation will run 5 times, once each for 2, 3, 4, 5 and 6 tellers. For each simulation, create an int array of tellers Set any variables necessary to 0 including the currentTime. Iterate while currentTime . Your Queue class needs a no-arg constructor to initialize the LinkedList object to null and methods of enqueue, dequeue and isEmpty. You can implement peek but you will not need it in this assignment. After compiling your Queue class, move on to a Customer class (NOTE: in lecture, I said that you would be storing Integer objects, but I misspoke create a separate class called Customer). This class will have two instance data: entryTime and serviceTime, both int values. Use a 2-arg constructor and have accessors for both methods. Have Customer implement Comparable (this is required for the PriorityQueue). The compareTo method will work as follows If this Customer's serviceTime-other Customer's serviceTime then return this Customer's entryTime other Customer's entryTime else return this Customer's serviceTime other Customer's serviceTime The idea here is that the Customer with the shortest serviceTime will be the first returned by the PriorityQueue, and on a tie, it is broken by the Customer with the earliest entryTime. If there is still a tie we don't care because the two Customers are virtually identical with respect to how the simulation treats them. This will be used to implement the "shortest job first" version of the PriorityQueue. You will also implement a "longest job first" which will use the exact same simulation code but the Customer's compareTo will be altered to return the two subtractions in the opposite order (that is, other Customer's entryTime -this Customer's entryTime and other Customer's serviceTime -this Customer's serviceTime) The simulation class will contain two objects, a line that is either a MyQueue Customer Stack or PriorityQueue and a Random to get random numbers. Your simulation will run 5 times, once each for 2, 3, 4, 5 and 6 tellers. For each simulation, create an int array of tellers Set any variables necessary to 0 including the currentTime. Iterate while currentTime