#include "Stoplite.h" StopLight::StopLight() { stateNS = Go ; stateEW = Stop ; time = 0 ; } // This is a rather silly Tick method.. void StopLight::Tick(int carPresent) { if (++time == 10) time = 0 ; if (time == 0) { stateEW = Stop ; } if (time == 7) { stateEW = Off ; } } // There should be six bulbXXX methods. // Some are missing! int StopLight::bulbNSR(void) { return stateNS == Stop ; } int StopLight::bulbNSY() { return stateNS == Caution ; } int StopLight::bulbNSG() { return stateNS == Go ; } int StopLight::bulbEWR() { return stateEW == Stop ; } int StopLight::bulbEWY() { return stateEW == Caution ; } int StopLight::bulbEWG() { return stateEW == Go ; } ;