#include "StopLight.h" StopLight::StopLight() { // You need to initialize stateNS here stateEW = Go ; time = 0 ; } // This is a rather silly Tick method.. void StopLight::Tick() { ++time ; if (time == 50) { time = 0 ; if (stateNS == Go) { stateNS = Stop ; stateEW = Stop ; } else { stateNS = Go ; stateEW = Go ; } } else if (time == 40) { stateEW = Caution ; } } // There should be six bulbXXX methods. // Some are missing! int StopLight::bulbNSR(void) { return stateNS == Stop ; } int StopLight::bulbNSY() { return stateNS == Caution ; } int StopLight::bulbEWR() { return stateEW == Stop ; } int StopLight::bulbEWG() { return stateEW == Go ; } ;