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 should

Using C++ implement a bank simulator For this project, you will implement a simulator that simulates customers entering and leaving a bank. You program should read the below input from a text file

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 a LinkedQueue class that provides a queue interface and stores a series of QueueItem objects in a linked structure. Your program must also implement a subclass 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 item i has a departure time less than the departure times of all items after i in the queue. Your program must declare two instances 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. The second instance of LinkedQueue will 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 OrderedQueue to 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

Step: 3

blur-text-image

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

Data Mining Concepts And Techniques

Authors: Jiawei Han, Micheline Kamber, Jian Pei

3rd Edition

0123814790, 9780123814791

More Books

Students also viewed these Databases questions

Question

What is the most important part of any HCM Project Map and why?

Answered: 1 week ago