72 % (143 Review)
ADT QUEUE and Simulation
For this assignment, you are to complete the bank simulation project, which uses a queue to simulate customers arriving and being served in a small bank. Recall the following assumptions:
?There is only one teller, and customers are served on a first-come-first-served basis.
?At any given minute of the day, there is a fixed probability of a customer arriving at the bank. For example, if the arrival probability is 15, then there is a 15% chance that a customer will arrive at any given minute.
?The length of the transaction for a given customer, in minutes, is a random integer between 1 and some fixed constant (initially set to 8 minutes).
The following classes have been provided for you: Customer, Server, and BankSimulator.
Part 1: ImplementingServiceCenter
To complete the simulation, you are to implement the ServiceCenterclass. An object of this class contains a single Serverobject for serving customers, and a queue of customers waiting to be served. The addCustomermethod should create a new customer, add him/her to the waiting queue, and display information about the customer. The doBusinessmethod should increment the current time and perform a step in the simulation, checking to see if the teller has finished with a customer and, if so, whether a new customer can be served. It should also display a message if the teller finishes or begins serving a customer. In addition, the getTimemethod should return the current simulation time, and customersRemainingshould return true if there are any customers currently in the system.
For example, the output of the simulation should look like the following:
What is the time duration (in minutes) to be simulated? 10
What percentage of the time (0-100) does a customer arrive? 30
2: Adding customer 1 (job length = 4)
2: Serving customer 1 (finish at 6)
4: Adding customer 2 (job length = 3)
5: Adding customer 3 (job length = 1)
6: Finished customer 1
6: Serving customer 2 (finish at 9)
9: Adding customer 4 (job length = 3)
9: Finished customer 2
9: Serving customer 3 (finish at 10)
10: Finished customer 3
10: Serving customer 4 (finish at 13)
13: Finished customer 4
Part 2: Maintaining Statistics
Once you have the simulation working correctly, add a method named displayStatsthat displays statistics on the simulation. You should modify the ServiceCenterclass so that it keeps track of:
1. the number of customers whose jobs have been completed,
2. the average waiting time for all customers whose jobs have been completed, and
3. the longest waiting time for any customer whose job has been completed.
The displayStatsmember function, when called, should display these statistics in a readable form. Add a call to the main method of BankSimulatorso that displayStatsis called at the end of the simulation to display statistics.
Part 3: Analysis
Once you have your bank simulation program working, answer these questions:
1. Assuming a banking day of 8 hours (480 minutes), how many customers would you expect to serve if the arrival probability were 20%. Do your simulations support this answer?
2. Assuming a banking day of 8 hours and an arrival probability of 15%, what is the average wait time for customers at the bank. Run several simulations and comment on the consistency of the results.
3. Assuming a banking day of 8 hours, what arrival probability can the bank handle and still keep the maximum wait time for customers under 10 minutes. Explain how you came up with this number.
Your answer will be ready within 2-4 hrs. Meanwhile, check out other millions of Q&As and Solutions Manual we have in our catalog.