PROGRAMMING ASSIGNMENT 4

Due dates:

  1. Header files - November 22, 1996
  2. Object .CPP files - November 27, 1996
  3. Entire Program (disk and printout) - Dec. 6, 1996
One useful application of queues and linked lists is in simulation. A simulation program is one which attempts to model a real-world situation to learn something about the situation. Each object and action in the real situation has its counterpart in the program. If the simulation is accurate, that is, if the program successfully mirrors the real world, then the result of the program should mirror the result of the actual actions being simulated. Thus it is possible to understand what occurs in the real world situation without observing its occurrence.

"Queueing theory is the study of models of service systems in which tasks wait to be processed. The objectives of the theory are to predict the delays faced by tasks before their processing is completed and also the backlog of tasks waiting to be processed. The theory is used to design the telephone network, computer systems, manufacturing plants, and computer networks. A queue is a service facility equipped with a waiting room. Using the standard terminology, customers arrive at the queue where they are required to spend some time, called a service time, with a server. There may be more than one server, and customers may have to wait for an available server. The customers leave the queue once they have received their amount of service time."


PROBLEM: There have been complaints from students in LH2 that their print jobs for the VAX printer ERRATO seem to take a long time to print. Should the Computer Center buy another printer?

You are to write a program that models a printer queue. Your program will read in a list of print jobs. Each print job contains a computer number requesting the print job, the time the printing is submitted and the number of pages to be printed. If nothing is being printed, the print job submitted is immediately sent to the printer and printed. If there is a job already being printed, then the new print job is entered at the rear of the queue. When a print job finishes, the queue is checked and if it is not empty then the first job in the queue is removed from the queue and it is printed. You can assume that the printer prints at a speed of 4 pages per minute.

After all the print jobs have been processed, your program should print the following results:


On a separate sheet of paper or by e-mail answer the following questions: