A queue of arrival events will represent the line of customers in the bank. Maintain the arrival
Fantastic news! We've Found the answer you've been seeking!
Question:
Maintain the arrival events and departure events in an ADT event list, sorted by the time of the event. Use a reference – based implementation for the ADT event list.
The input is a text file of arrival and transaction times. Each line of the file contains the arrival time and required transaction times. 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 numbers of arrivals and average time spent waiting in line). For example, the input file shown in the left column of the following table should produce the output shown in the right column.
Input File Output
1 5 Simulation Begins
2 5 Processing an arrival event at time: 1
4 5 Processing an arrival event at time: 2
20 5 Processing an arrival event at time: 4
22 5 Processing a departure event at time: 6
24 5 Processing a departure event at time: 11
26 5 Processing a departure event at time: 16
28 5 Processing an arrival event at time: 20
30 5 Processing an arrival event at time: 22
88 3 Processing an arrival event at time: 24
Processing a departure event at time: 25
Processing an arrival event at time: 26
Processing an arrival event at time: 28
Processing an arrival event at time: 30
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: 88
Processing a departure event at time: 91
Simulation Ends
Final Statistics:
Total number of people processed: 10
Average amount of time spent waiting: 5.6
Methodologies: using a queue to hold the data and create methods to process it.
Related Book For
Managerial Decision Modeling with Spreadsheets
ISBN: 978-0136115830
3rd edition
Authors: Nagraj Balakrishnan, Barry Render, Jr. Ralph M. Stair
Posted Date: