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
simulate that performs the simulation in the sense of computing the statistics needed by the other methods of the class. This method takes a single integer parameter representing the number of time steps -- not the number of cycles -- in the simulation.
int getNSVehicleCount that returns a count of all of the vehicles that have arrived at the traffic light heading north or south
int getEWVehicleCount that returns a count of all of the vehicles that have arrived at the traffic light heading east or west
int getVehicleCount that returns a count of all of the vehicles that have arrived at the traffic light
double computeAverageNSWaitingTime that returns the average waiting time in seconds of all of the vehicles that have arrived at the traffic light heading north or south
double computeAverageEWWaitingTime that returns the average waiting time in seconds of all of the vehicles that have arrived at the traffic light heading east or west
double computeAverageWaitingTime that returns the average waiting time in seconds of all of the vehicles that have arrived at the traffic light
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.