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."
You have been asked to write a program that manages your answering machine. Your program will make an entry for each phone message you receive. Each message contains the Name and Phone Number of the caller as well as the date (month/day/year) and time (hours:minutes) that records the time when the message was received. A Latest Attempt field is initally set to 0, inidcating that no attempt has been made to return the call. For example, a message may appear as:
Rio Brazil (505) 555-1111 4/15/97 16:45 0
Write your C++ program to store the messages in a queue as they are received and feed them to you, one at a time, upon request. If you cannot reach a person when you try to call, place that record at the end of the queue and fill the Latest Attempt field with the time you tried to return the call, in the form DaysLater/hours:min. Thus if your last unsuccessful attempt to return Rio Brazil's call was on 4/17/97 at 8:15, the new enqueued message would be
Rio Brazil (505) 555-1111 4/15/97 16:45 2/8:15
Make sure the user is aware of the time and date when the last attempt was made to return the call.
Remember that a Queue is a specialized List where entries are added to the queue in the rear and removed from the front of the queue. You may use either the array or linked implementation of a queue.