next up previous
Next: Extra credit Up: Your job in this Previous: Changing the current speed

Processing after a clock tick

You must also write the code that changes the state of the accelerator at each clock tick. This is the body of method CruiseControl.main.

Here, you should write an infinite loop that (0) waits for a clock tick to occur -- call method CruiseConttrol.sleep for this -- and then (1) does whatever processing is necessary to update the cruise control system. Note that this should include printing data to the output window using System.out.print if the state of the system calls for it. It will be best if printing data to the output window is done via a separate method (and method main just makes a call to it).

The design of this portion of the program is up to you. Naturally, you can/should make use of the methods that you wrote for the previous tasks.



Claire Cardie
1998-11-11