Objective
Create and use queues
Instructions
Develop a java program that simulates the queues in a bank.
Bank Queue Simulation Problem
Implement the event-driven simulation of a bank that this chapter described on pages 434 through 444. A queue of arrival events will represent the line of customers in the bank. Maintain the arrival events and departure events in an ADT event list, sorted by the time of the event.
Your program must count the 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).
Input
In this section, the various input tables are described.
Customer Table
The Customer Table identifies the Customers coming into the bank, the time they arrive and the transactions they wish to perform. Note that a Customer may want to perform multiple transactions.
Transaction Number | Customer ID | Arrival Time | Transaction Type |
---|---|---|---|
1 | 1 | 1 | Transfer |
2 | 1 | Deposit | |
3 | 2 | 4 | Withdrawal |
4 | 2 | Account Balance | |
5 | 3 | 7 | Account Balance |
6 | 3 | Withdrawal | |
7 | 3 | Deposit | |
8 | 4 | 8 | Withdrawal |
9 | 5 | 9 | Transfer |
10 | 6 | 13 | Transfer |
Transaction Type Table
The Transaction Type table identifies the duration for the teller to perform each Transaction Type.
Transaction Type ID | Transaction Type Description | Duration |
---|---|---|
1 | Deposit | 4 |
2 | Withdrawal | 2 |
3 | Transfer | 3 |
4 | Account Balance | 1 |
Output
The table below should be output to show the customers arrival time, the time waiting in line and the time they depart. This information should be used to calculate the total number of arrivals and the average wait time.
Customer | Arrived | Waiting Time | At Teller | Transaction Time | Departed |
---|---|---|---|---|---|
1 | 1 | 0 | 1 | 7 | 8 |
2 | 4 | 4 | 8 | 3 | 11 |
Submit
Submit the following:
- Requirements
- Test Cases
- UML diagram for the application
- Text file(s) containing the classes and methods
- Text file containing the results