Can anyone give me suggestions how how they would go about writing the code for this problem. I am not looking for actual code just suggestions and or pseudo code algorithm?
Queue program: Develop a queue class using a linked list representation and use it in a program to simulate a check-out line at a supermarket. Customers arrive in random integer intervals of 1 to x minutes. Also, each customer is serviced in random integer intervals of 1 to x minutes. Request a value for x at the beginning of the run. Run the supermarket simulation for a 12-hour day (720 minutes) using the following algorithm:
Choose a random integer between 1 and x to determine the minute at which the first customer arrives.
At the first customer’s arrival time:
Determine customer’s service time (random integer from 1 to x)
Begin servicing the customer;
Schedule the arrival time of the next customer (random integer 1 to x added to the current time)
For each minute of the day:
If the next customer arrives,
Enqueue the customer;
Schedule the arrival time of the next customer;
If service was completed for the last customer:
Say so;
Dequeue the next customer to be serviced;
Determine customer’s service completion time;
At the end of the simulation, your program should print out the maximum number of customers in the queue at any one time, and the longest wait any one customer experienced.



LinkBack URL
About LinkBacks


