Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public static void main (String[] args) {
  2.  
  3. Scanner input = new Scanner(System.in);
  4. System.out.println("Welcome to the To Do list app");
  5. int length = 0;
  6. String[] listToDo = new String[length];
  7. String menu = "edit";
  8.  
  9. while (menu != "exit") {
  10. System.out.println("type *edit* to edit, *view* to read and *cancel* to cancel");
  11. String userListItem = new String();
  12. menu = input.next();
  13. if (menu == "edit") {
  14. System.out.println("How many items do you want to add to the list?");
  15. System.out.println("hit enter to move to the next line or enter *:q!* to exit");
  16. length = input.nextInt();
  17. for (int counter = 0; counter < length; counter++) {
  18. userListItem[counter] = input.nextLine();
  19. if (!userListItem.isEmpty()) {
  20. listToDo[counter] = userListItem;
  21. }
  22. if (userListItem.equals(":q!")) {
  23. break;
  24. }
  25. }
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement