GameNCode

Cube Tower Main

Sep 4th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. /**
  2. * Created by roywe on 9/3/2017.
  3. */
  4. import java.util.*;
  5.  
  6. public class Main {
  7. public static void main(String []args)
  8. {
  9. boolean run = true;
  10. System.out.println("Enter amount of cubes");
  11. Scanner UI = new Scanner(System.in);
  12. Cube[] cube = new Cube[UI.nextInt()];
  13. CubeTower ct = new CubeTower(cube.length, 0, cube);
  14. while(run) {
  15. System.out.println("Choose an action");
  16. System.out.println("1 - Add cube");
  17. System.out.println("2 - Remove cube");
  18. System.out.println("0 - Quit");
  19. switch (UI.nextInt()) {
  20. case 1:
  21. ct.addCube();
  22. break;
  23. case 2:
  24. ct.minusCube();
  25. break;
  26. case 0:
  27. run = false;
  28. break;
  29. default:
  30. break;
  31. }
  32. System.out.println("There are " + ct.getCubes() + " cubes");
  33. }
  34. }
  35.  
  36.  
  37. }
Add Comment
Please, Sign In to add comment