Advertisement
Guest User

Untitled

a guest
Nov 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. package ss.week2;
  2.  
  3. import ss.utils.TextIO;
  4. import ss.week2.ThreeWayLamp.state;
  5. import ss.week2.ThreeWayLamp;
  6.  
  7. public class ThreeWayLampTUI {
  8.  
  9. public static void main(String[] args) {
  10. ThreeWayLamp.printMenu();
  11. boolean running = true;
  12. ThreeWayLamp currentLamp = new ThreeWayLamp();
  13. while (running){
  14. String input = TextIO.getlnString();
  15. switch (input)
  16. {
  17. case "off":
  18. currentLamp.setValue(state.OFF);
  19. break;
  20. case "low":
  21. currentLamp.setValue(state.LOW);
  22. break;
  23. case "medium":
  24. currentLamp.setValue(state.MEDIUM);
  25. break;
  26. case "high":
  27. currentLamp.setValue(state.HIGH);
  28. break;
  29. case "state":
  30. System.out.println(currentLamp.getValue());
  31. break;
  32. case "next":
  33. currentLamp.nextValue();
  34. break;
  35. case "help":
  36. ThreeWayLamp.printMenu();
  37. break;
  38. case "exit":
  39. running = false;
  40. break;
  41. default:
  42. System.out.println("Fill in a possible option");
  43. break;
  44. }
  45. }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement