Behavioral Patterns  «Prev  Next»

Testing Interface - Exercise

Objective: Run a test on your Vehicle classes.
We are close to finishing the course project. Only two major classes remain. The Timer class will serve as a central clock for the rest of the system. The SignalMediator class will manage the state of the different traffic lights. These will be developed later in the module, using two behavioral patterns. For this exercise, you will run a test on the Vehicle classes you have already created. To do so, you will write a program that:
  1. Creates a VehicleQueue
  2. Inserts 100 vehicles in the queue
  3. Prints out the total length of the queue, the number of vehicles in the queue, and a list of vehicles in the queue.

In the text area below, type your answer and click the Submit button.