Reimplement the TrafficLight class using a simple counter that is advanced in each call to next. If the traffic light was initially green, the counter has values 0 1 2 3 4 5 6 ... . If the traffic light was initially red, the counter has values 2 3 4 5 6 7 8 ... . Compute the current color and the number of reds, using integer division and remainder.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here