The problem is to simulate a sales operations in McM's. In this problem you will write a program to simulate customers being served in favorite fast food restaurant. The maximum configuration of the establishment will be on the first line of input. It will determine the number of drive though lanes and the number of registers serving the people in the restaurant. Initially all registers are closed i.e. no customer will be served before one has been opened. A register (or a drive through lane) can be activated or closed at any time, you decide when. These changes of status will take effect on the following time unit. When a register is opened a line (queue) is to be created for the people waiting to be served, and two other queues for the people who have purchased their meal, but have not been served yet, to wait for their meal. There will be one of these wait queues for each of the drive through lanes. There is no limit to the length of the queues in which people are waiting to be served, but each queue where people are waiting for their order can only have 3 customers at any time, with the exception of the drive through lanes which can handle 4 customers. Each sales person can serve one customer at any time unit. A sales person who is taking care of one of the drive through lanes has to also take care of one of the registers. This forces the person to decide, who to service next, the drive through or the restaurant queue. At the time of sale the customer will decide how many items they will order. The wait time for the order is 3 time units per item. In the simulation the number of items will be determined by a random number generator. At most 10 items per purchase. We will talk about the random number generator and seeding it in the class on Monday April 15. In this simulation an arbitrary number of customers will enter the restaurant at any time unit. You will know whether they come into the restaurant or enter a drive through lane. Each of them will need to be assigned a unique customer number and be placed into one of the queues, which one is up to you. A customer cannot be placed into the drive though lane queue unless he/she is a drive though customer and same applies to in restaurant customers.
Any time unit an open register or an open drive though lane can process single order as long as there is room in one of the order wait queues for that register or drive through lane. Be smart on how you place customers into queues, if there is extra wait the customers are not happy and will be lost. They will not want to wait more than 25 time units and if they have waited over 15 time units they are unhappy about the service. Once a customer is within the next three to be served, the line the customer is waiting cannot be changed. If the line is changed the customer will have to enter at the end of the line. For every register that is open for sales, but does no sales for more than 2 time units, it will cost one sale for every time unit past two that it does no sales. (NO penalty if the register is held up because the wait lines are full.) Your job is to design a queuing system that will serve as many people as possible and as few people as possible will leave without eating and of course maximize the number of sales. Commands and the data will come from stdin, and output will go to stdout. The input line can contain any of the following info: First line - three numbers: 2 7 1234 2 - maximum number of drive through lanes 7 - maximum number of in restaurant registers 1234 - value to use to seed the random number generator Rest of the lines - two numbers and an optional command: 1 8 p 1 - a single customer enters into drive though lanes 8 - 8 customers entered the restaurant and are to be placed into queues p - if a p is present at the end of the line, print out the content of all queues in a nice understandable format Output from the p commad needs to include the customer sequence number and the number of time units the customer has waited for service. The simulation ends after the last line of input has been processed. The last line of the input will contain -1 -1. At this time you are to print out the content of the queues and final statistics: total number of customers total number of items sold number of customers served in restaurant number of customers served in drive though lane number of unhappy customers number of customers that left without getting served number of customers that switched queues total number of item costs lost due to the extra registers being open average time a customer waited before ordering average time a customer waited after ordering Part of this assignment is a Makefile which builds an executable called mcm
c++(unix based g++)