Assignment 9, CS 46A
50 points
due November 12, 2003

Define an A9Simulator class, to be used to perform 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 to be deterimed by the simulator. Your class is to have a constructor with parameters that represent

and the following public methods:

All counts and computations should include only traffic arriving since the simulator was constructed. 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. Unlike in Assignment 8, the counts and averages should include vehicles that have the green light and do not stop.

You may define any additional classes or private methods that you find helpful.

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 A9Simulation.java, which is provided on the class web site.