Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C++ implement a bank simulator For this project, you will implement a simulator that simulates customers entering and leaving a bank. You program will

Using C++ implement a bank simulator For this project, you will implement a simulator that simulates customers entering and leaving a bank. You program will be given as input a configuration file that contains the number of tellers to simulate and the arrival time and service time of each customer. An example configuration file will look as follows: numTellers 3 arrival 35 service 62 arrival 39 service 57 arrival 78 service 124 arrival 79 service 32 In this example, there are three tellers working at the bank. Customer 1 arrives at time 35. Since there are no other customers in the bank, all tellers are free and the customer can be serviced immediately. The cusomer's departure time is calculated as 97 (35+62). Customer 2 arrives at time 39, can be serviced immediately, and is scheduled for departure at time 96. Customer 3 arrives at time 78, can be serviced immediately, and is scheduled for departure at time 202. Customer 3 arrives at time 79. Unfortunately, all tellers are busy. At time 96, customer 2 leaves, freeing a teller and customer 4 can be serviced. Customer 4's departure time is scheduled as 128 (96+32). The output of your program will be a list of the wait times and wait plus service times for all customers. You can output this information to a file or to standard output. For the previous example, the output would be the following: wait 0 waitandservice 62 wait 0 waitandservice 57 wait 0 waitandservice 124 wait 17 waitandservice 49 Your program must implement aLinkedQueue classthat provides a queue interface and stores a series of QueueItem objects in a linked structure. Your program must also implement asubclass of LinkedQueue called OrderedQueue. The OrderedQueue will inherit all of the LinkedQueue functions, but will override the enqueue function. The OrderedQueue enqueue function will insert items into the queue such that an itemihas a departure time less than the departure times of all items afteriin the queue. Your programmust declaretwoinstances of the LinkedQueue class. The first will store information about each customer arrival that has not yet been processed. When your program starts, you should open the input configuration file and read in the customer arrival data. For each arrival, create a QueueItem object and insert it into the queue. You can assume that the data stored in the file will be sorted by arrival time. Thesecond instance of LinkedQueuewill store information about customers waiting in line. In other words, if a customer arrives and cannot be serviced, that customer's arrival and service information is stored in the waiting queue. Your program must also declare an instance of the OrderedQueueto store information about customers currently being serviced. When a teller is freed, the next customer in the waiting line is removed from the waiting line and put into the line of customers being serviced. If no customers are waiting, the teller remains unoccupied until another customer arrives.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

App Inventor

Authors: David Wolber, Hal Abelson

1st Edition

1449397484, 9781449397487

More Books

Students also viewed these Programming questions

Question

- How can facebook prevent another data breach?

Answered: 1 week ago