Write a function named "simulate()" that implements the simulation discussed in section 13.4 of the text linked in project 33.1. Follow the pseudocode provided there closely. You'll have a main() function that is nothing more than a call to this function.
Use the STL queue and priority_queue classes.
As the pseudocode indicates, you are required to have a "processArrival()" function and a "processDeparture()" function.
Hints:
I created a class named "Event" and a class named "Customer". I made all of the data members public, in order to make the task simpler. (You can do the same.) There were no member functions in either class, except for operator<() in the Event class (see below).
In order to use the STL priority_queue class, your Event class will need to define an operator<() function. This is how the priority_queue class will compare your Events to determine which ones have higher priority. Events with earlier times should have a greater priority. Also, in the case of a tie, arrivals should have a higher priority than departures.
Let me say more about this, in case it seems mysterious.
Somewhere in the code for the STL priority_queue class, there is code that compares two of the objects in the priority_queue to see which one has the higher priority. If you try to use a priority_queue of Events without providing an overloaded operator<(), you'll get a syntax error that says something like "no < operator is defined for objects of type Event". So, you need to provide a < operator as a member function of the Event class. (You could make it a friend function. I just made it a member function.)
Both of my classes have a data member "customerID", which is an int.
Your program should produce exactly the same output as given in the following example input and output:
Full documentation is required.
zyBooks Submission Note:
For zyBooks submission, your simulate() function should open (and process) a file named "in1.txt".