HW4 Solution

This problem is very similar to the simulation on page 324-334, except that we have an additional phone call event. So we need to keep in the event list the next door arrival event A, the next phone call event P, and the next departure event D. 

We need to process phone call P like these:

ProcessPhoneCall:
1. We will have to deal with the phone call first and delay the departure time of the current client C.
2. Find the departure event D of the current client, and remove it from the event list.
3. Update the information of the current client C, the remained transaction time.
        C.transaction_left = D.departure_time - P.arrival_time
2. Put the calling client in the front of the customer queue.
3. Insert into the event list a departure event of the calling client.
        D'.departure_time = P.arrival_time + P.transaction_length

The processes of DoorArrival and Departure events are the same as described in the book. Be aware that when generating the departure event, the departure time should be:
        departure_time = current_time + transaction_left

Test.cpp    Simulator.h    Simulator.cpp

ItemType.h    SortedList.h    SortedList.cpp    Queue.h    Queue.cpp