https://github.com/mosheberman/trafficlight
TrafficLight is a Java homework assigned in one of my classes this semester, at Brooklyn College. (Spring 2013)
https://github.com/mosheberman/trafficlight
Last synced: 10 months ago
JSON representation
TrafficLight is a Java homework assigned in one of my classes this semester, at Brooklyn College. (Spring 2013)
- Host: GitHub
- URL: https://github.com/mosheberman/trafficlight
- Owner: MosheBerman
- Created: 2013-05-23T05:53:53.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2013-05-23T13:46:10.000Z (about 13 years ago)
- Last Synced: 2025-03-13T15:17:37.497Z (over 1 year ago)
- Language: Java
- Size: 219 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TrafficLight
============
TrafficLight is a Java homework assigned in one of my classes this semester, at Brooklyn College. (Spring 2013)




What It Does:
---
The StopLight class simulates a traffic light at an intersection. The light remains green for 50 seconds, turns yellow for 10 seconds, and then red for 60 seconds.
The Cross Button:
---
The Cross button becomes enabled when the light is green, but only ten seconds after the light has switched from red to green. Clicking on it accelerates the light, by immediately cycling to yellow. This way, it becomes safe to cross sooner, because the yellow light becomes red after ten seconds.
Threading:
---
StopLight.java utilizes a Thread subclass to drive the timer loop of the light cycle. It calls a synchronized method on the StopLight which should cycle the light. It won't if the button is in the middle of causing a change, though.
License:
---
Feel free to inspect my coding style, but don't redistribute it.