Assignment 8, CS 46A
40 points
due November 5, 2003

Define a Simulator class, to be used to support simple traffic simulations. The simulation is assumed to be of a single traffic light, which traffic may approach either from the north or south, or from the east or west. The timing of the light and the times of arrivals at the light are deterimed outside of the simulator.Your class is to have the following methods:

All counts and computations should include only traffic arriving since the simulator was constructed or last reset. The waiting time should include only the time waiting for the light to turn green, not the time lost in slowing down, in speeding up, or in reaching the light after having stopped.

For this assignment, you should provide a copy of your code on diskette (no CD or email), and hard copies of your code and the results of your testing with the file A8Simulation.java, which is provided on the class web site.

It will not be immediately clear whether the answers that you print are correct. You can do some checking by

Note that the A8Simulation.java file contains some simulation detail and is thus not optimally designed for simulations -- especially repeated simulations. You will have an opportunity to address this issue in Assignment 9.