
Due to my delay in getting the Assignment #4 ready, I will
split what I had planned for #4 into two pieces.  Together
they will be due at the beginning of the tutorial on Friday, Dec. 5.  

Make sure you have taken a look at the program sim.cpp and the simulation
course notes on the web page.  This will make the current assignments
much easier.  For example, the classes for events used in the 
clientServer code are simplifications of some of those used in sim.cpp.
Feel free to model your solutions for assignments 4 and 5 on this code
sim.cpp, although in both cases your solutions should be an extension
of the clientServer code (so, for example, it should use clientQueue
and eventHeap).

=================================

Assignment 4 involves adding a single server to the clientServer
C++ code.  

To begin, you should make the current code, by typing
 make events
and run it by typing
 events
or
 ./events
(in the latter case, see the README file in this directory).

The specification for the required server is very simple.
The server should simply find the next client on the queue who
has not yet balked (i.e. given up waiting).  If it finds one
still waiting, then it should select a random length of time for
serving this client from an exponential distribution with rate
parameter called "servingRate".  For example, in a similar way
that arrivalRate is defined in the current code,
  double servingRate=0.2;
would make the serving rate twice as fast as the current arrivalRate.

The control for the server must be built into the event
driven simulation.  That is, the server can be called upon
a client arrival event, or upon the completion of a service interval.

=================================

Assignment 5 involves adding events to compute performance statistics
at regular time intervals during the simulation.  You should also
report these statistics at the end of the simulation, so the current
method makeItHappen() for the allDoneClass needs to be modified.

The statistics that are to be reported are:
 a) mean waiting time for clients
 b) mean service time for clients
 c) total length of time the server was busy serving a client.
 d) number of clients balked
 e) number of clients served
 f) mean queue length
In all cases, these quantities should be computed from the beginning
of the simulation, that is t=0.  

For (a) and (b) you should only include those clients who have completed
waiting and service, respectively, at the end of the simulation.  That is,
do not include clients left waiting at the end of the simulation in the
statistic for part (a), or clients left being served at the end of the
simulation for the statistic (b).

Finally, to do part (f), you need to compute the number of
clients waiting in the queue who have not yet balked.  To do
that you need to add the method

  Queue<T>::count_if

to the Queue template class implemented in file ADT.cc.  That
is, the declaration for count_if is:

  // count_if returns the number of elements currently in the
  // queue for which checks_ok(T) evaluates to true
  template<class T> int Queue<T>::count_if(bool (*checks_ok)(T));

You need to define the appropriate method in ADT.cc and to
add the declaration above to ADT.h.  You can then use this method
to find the number of clients in the clientQueue who have not yet balked
by passing it the pointer to a function such as:

  bool clientWaiting(clientClass * pClient);
  // returns true only if the client pointed to by pClient has
  // wait_status equal to WAITING.

This provides the queue length.

=================================

You do not need to hand in two program listings.  One program
which solves both assignments is sufficient.  You need to include
a discussion for the design and testing of your solutions,
preferably separated into the two parts, one for each of the
assignments.

