Question
Language: C++ Implement Chapter 13, Programming Problems 6 and 7c. EXTRA CREDIT: You can get up to a 25/20 by completing 7C. Even though this
Language: C++
Implement Chapter 13, Programming Problems 6 and 7c.
EXTRA CREDIT: You can get up to a 25/20 by completing 7C. Even though this is extra credit, you should at least look at it (as you are likely to see it again very soon)
For this assignment you may (and probably should) use the C++ STL queue and priority_queue
_________________________________
So at a very high level. You are creating a priority queue that has the events. You can have arrival and departure events. This is sorted by the time of arrival or departure (respectively). Because it is a priority queue, every add or delete action forces the built-in functions of the priority queue to sort it on the time of arrival. Priority queues normally sort o the highest (time) but we want it to sort on lowest. As a result you have a mix of arrival and departure events mixed in with each other.
If it is an arrival type of event at the top of the priority queue: Get the value of the top item, then pop it off. If there are no people in the bankline (queue) and the teller is available then process that event. In processing the event, we add a departure event to the priority queue (and it will sort itself), starting at the current time plus the listed transaction time (teller is unavailable for more customers during that transaction. In that departure even we keep track of the original arrival time.
If it is a departure event at the top of the priority queue: Get the value of the top item then pop it off and process the departure. If there are no people in the bankline (queue). Because someone just finished with the teller, the teller is now available for another customer. Look in the bankline (queue) to see if there are any people in the bankline.
When you have a departure event, you have enough information to determine how much the customer waited.
To access priority queue, use the following include statement: #include priority-queue ever you need a queue or a priority queue for any of the following problems, use the classes ouroueue our PriorityQueue that Programming Problems I and 2 ask you to write. and Implement the palindrome-recognition algorithm described in Section 13.2.2. mplement the recognition algorithm that you wrote to solve Exercise 2 using the classes ouraueue, as described in Programming Problem l,and 0urStack, as described in Programming Problem l of Chapter 6 Implement the radix sort of an array by using a queue for each group. The radix sort is discussed in Sec tion 11.2.3 of Chapter 11 6. Implement the event-driven simulation of a bank that this chapter described. A queue of arrival events will represent the line of customers in the bank. Maintain the arrival events and departure events in a priority queue, sorted by the time of the event Use a implementation for the priority queue. The input is a text file of arrival and times. Each line of the file contains the arrival transaction time and required transaction time for a customer. The arrival times are ordered by increasing time. statistics Your program must count customers and keep track of their cumulative waiting time. These a trace are sufficient compute the average waiting time after the last event has been processed. Display average of the events to statistics (the total number of arrivals and table executed and a summary of the computed of the following spent waiting in line). For example, the input file shown in the left columns should produce the output shown in the right columnStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started