Advertisement
Guest User

Untitled

a guest
Apr 20th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. import java.util.ArrayList;
  2. import java.util.Scanner;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7. System.out.println("Hello TODO list!");
  8.  
  9. String myFirstTask = "Ugotować kolację";
  10. System.out.println(myFirstTask);
  11. ArrayList<String> tasks = new ArrayList<>();
  12. tasks.add(myFirstTask);
  13.  
  14. for(int i = 0; i <100; i++) {
  15.  
  16. showMenu();
  17. Scanner input = new Scanner(System.in);
  18. String choice = input.next();
  19. System.out.println("Wybrałeś: " + choice);
  20.  
  21. switch (choice) {
  22. case "1":
  23. System.out.println("Twoje zadania na dziś");
  24. System.out.println(tasks);
  25. break;
  26.  
  27. case "2":
  28. System.out.println("Podaj zadanie");
  29. String newTask = input.next();
  30. tasks.add(newTask);
  31. break;
  32.  
  33. case "3":
  34. tasks.remove(0);
  35. break;
  36.  
  37. case "4":
  38. System.out.println("Koniec programu");
  39. return;
  40. }
  41. }
  42. }
  43.  
  44. public static void showMenu() {
  45. System.out.println("Wybierz co chcesz zrobić");
  46. System.out.println("1 - pokaż listę zadań");
  47. System.out.println("2 - dodaj nowe zadanie");
  48. System.out.println("3 - oznacz pierwsze zadanie jako wykonane");
  49. System.out.println("4 - zakończ program");
  50. }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement