Using this information, the bank officers can determine how many tellers are needed to ensure reasonably smooth service.

We have a system, such as a bank, where customers arrive and wait on a line until a teller is available. We are interested in how long on average a customer has to wait. Using this information, the bank officers can determine how many tellers are needed to ensure reasonably smooth service.

A simulation consists of processing a random sequence of events. At each step, the next randomly generated event is either:

A new customer, with a given priority, arrives.

A customer at a teller leaves.

The customer arrival, waiting, and departure times are not computed according to the real time, but to the number of ticks. A tick is a quantum unit representing one arrival or departure event.

At each step, if the event is an arrival, we have to add that customer, his arrival time, and his priority to a heap priority queue. The priority is a random value in the range 1-100.

If the event is a departure, processing includes gathering statistics for all departing customers (their average waiting time). After each departure, display the following updated output:

Sample Output: “The average waiting time for … customers was … ticks.”

You have to use class PriorityQueue from Java Collections Framework and you are not allowed to modify this class.

Create class Event. Consider each arrival and each departure as objects of type Event.

Create class Customer.

Create class CustomerCompare, implementing interface Comparator.

Generate the UML class diagrams.

Design and Implementation

Project uses class PriorityQueue from JCF to contain customers /15

Project uses class Event /10

Project uses class Customer /10

Project uses class CustomerCompare, implementing interface Comparator /15

Input/Output and Processing

The arrival/departure events are generated in an input stream, according to a random variable /15

After each departure, the updated average waiting time is displayed /15

UML documentation

UML class diagrams. /10

Style and Comments /5

Coding Efficiency /5

× How can I help you?