Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ss.week2;
- import ss.utils.TextIO;
- import ss.week2.ThreeWayLamp.state;
- import ss.week2.ThreeWayLamp;
- public class ThreeWayLampTUI {
- public static void main(String[] args) {
- ThreeWayLamp.printMenu();
- boolean running = true;
- ThreeWayLamp currentLamp = new ThreeWayLamp();
- while (running){
- String input = TextIO.getlnString();
- switch (input)
- {
- case "off":
- currentLamp.setValue(state.OFF);
- break;
- case "low":
- currentLamp.setValue(state.LOW);
- break;
- case "medium":
- currentLamp.setValue(state.MEDIUM);
- break;
- case "high":
- currentLamp.setValue(state.HIGH);
- break;
- case "state":
- System.out.println(currentLamp.getValue());
- break;
- case "next":
- currentLamp.nextValue();
- break;
- case "help":
- ThreeWayLamp.printMenu();
- break;
- case "exit":
- running = false;
- break;
- default:
- System.out.println("Fill in a possible option");
- break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement