CS 2401 Assignment #8

Due Date: Wednesday, July 25, 2012.

Objective: The goal of this assignment is to practice the use of queues.

Assignment: In many Olympic competitions such as high jump, athlete wait in a line to show their skills. Let us emulate this line.

Your simulation will simulate a 20 minutes interval. Each high jump may require several attempts, so it takes between 1 and 3 minutes to complete. New competitors arrive over time, with some randomness. In your simulation, the number of new competitors that arrive on each time step will vary between 0 and 1. To execute the simulation, at each moment of time, perform the following steps:

We are interested in two important values: the average length of the queue of competitors, and the maximum length of the queue. Your program should compute these values. Repeat simulations 100 times and compute the average and maximum over all these simulations. Write the code of the main part of the program so that the code only uses the ADT operations enqueue, dequeue, size, and isEmpty. Then, show that your program works with both types of queue implementation -- as a linked list and as an array.