Download Solution: Click to Download Solution
Solution File Name: TrafficLight.doc
Unzip Password: prestobear.com
Problem:
In this class, we will write a program that simulates a traffic light.
The program lets the user select one of three lights: red, yellow, or green.
When a radio button is selected, the light is turned on. Only one light can be on at a time
No light is on when the program starts.
1. MyTrafficLight.java
import javafx.application.Application;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.RadioButton;
import javafx.scene.control.ToggleGroup;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.scene.shape.Shape;
import javafx.stage.Stage;
/**
*In this class, we will write a program that simulates a traffic light.
*The program lets the user select one of three lights: red, yellow, or green.
*When a radio button is selected, the light is turned on. Only one light can be on at a time
*No light is on when the program starts.
*/
public class MyTrafficLight extends Application {
}
2. TestTraffic.java
import javafx.application.Application;
public class TestTraffic {
}