OO Programming in Java

Class 8 Homework Assignment



Implement a Traffic Lite Controller

See Quiz 2



To help you we are providing the Simulator .. a View for your TLC

We will supply the View and the TLCAdapter class. You must edit the stubs for sensor methods and call methods in the adapter to change the states of lites.

The method names shown above near the components are TLCAdapter method names.

Note that the there are only four PedLite (String) methods because the PedLites operate in pairs.


PedLites (String) where String is "walk", "dontwalk" or "dark"

ThruLites (String) where String is "green", "yellow", "red" or "dark"

LeftLites (String) where String is "left", "yellow", "red" or "dark"

Example:


To turn on the south pedestrian lites: From your TrafficLiteController Class say ....

this.tlcAdapter().sPedLite("dontwalk")
   
To get called when the south left lane sensor is tripped:

The TLCAdapter method sLeftTrig() will be called and you must fill in its stub with the method you would like to call in your TrafficLiteController

Inside TLCAdapter:

public void sLeftTrig(){
    this.trafficLiteController().myMethod();
}
   
Now go here for an object model and some more details