Question: In this assignment you will implement the event-driven simulation of a bank. You will need to use a queue of arrival events to represent the

In this assignment you will implement the event-driven simulation of a bank. You will need to use a queue of arrival events to represent the line of customers in the bank. You will also need to maintain an event list which includes the arrival events and departure events, sorted by the time of the event.

The input is a text file (named input.txt) of arrival and transaction times. Each line of the file contains the arrival time and required transaction time for a customer. The arrival times are ordered by increasing time.

Your program must count customers and keep track of their cumulative waiting time. These statistics are sufficient to compute the average waiting time after the last event has been processed. Display a trace of the events executed and a summary of the computed statistics (total number of arrivals and average time spent waiting in line).

There are two types of events, arrival event and departure event. Notice that the file does not include departure events; the data does not specify when a customer will complete the transaction and leave. Instead, the simulation must determine when departures occur. A customers wait time is the elapsed time between arrival in the bank and the start of the transaction.

Instead of putting all the unprocessed arrival and departure events in the event list, you can simply put the next arrival event and the next departure event in the event list, sorted by the time of the event. If an arrival event and a departure event have the same time, the arrival event precedes the departure event.

For this assignment, you will need to write three classes, the Event class, the EventList class, and the Simulation class (with the main method). In this assignment you will implement the event-driven simulation of a bank.

Below is a sample input (on the left column) and sample output (on the right column) Input File Output Simulation Begins Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 6 Processing a departure event at time: 11 Processing a departure event at time: 16 Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 25 Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 30 Processing a departure event at time: 35 Processing a departure event at time 40 Processing a departure event at time: 45 Processing a departure event at time 50 Processing an arrival event at time: Processing a departure event at time 91 Simulation Ends 4 205 225 245 265 285 305 883 4 20 24 26 28 30 Final Statistics Total number of people processed Average of time spent waiting 10 5.6 Below is a sample input (on the left column) and sample output (on the right column) Input File Output Simulation Begins Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 6 Processing a departure event at time: 11 Processing a departure event at time: 16 Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 25 Processing an arrival event at time Processing an arrival event at time Processing an arrival event at time Processing a departure event at time: 30 Processing a departure event at time: 35 Processing a departure event at time 40 Processing a departure event at time: 45 Processing a departure event at time 50 Processing an arrival event at time: Processing a departure event at time 91 Simulation Ends 4 205 225 245 265 285 305 883 4 20 24 26 28 30 Final Statistics Total number of people processed Average of time spent waiting 10 5.6

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!