Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1.  
  2.  
  3. import java.util.Scanner;
  4.  
  5. public class BestFriendsArrayList //calls all the methods after prompting the menu options.
  6. {
  7.  
  8. public static void main(String[] args) {
  9.  
  10. BestFriendArrayListHelper myHelper = new BestFriendArrayListHelper();
  11. Scanner sc = new Scanner(System.in);
  12. System.out.println("Welcome to the friend phone book!\n ");
  13. int menuSelection = 0;
  14. do {
  15. System.out.println("\n1. Add a friend"); //default menu options from user to choose from
  16. System.out.println("\n2. Change a friend's contact info");
  17. System.out.println("\n3. Remove a friend's contact info");
  18. System.out.println("\n4. Display a friend's contact info");
  19. System.out.println("\n5. Exit menu");
  20. System.out.print("Please make a selection: ");
  21. menuSelection = sc.nextInt();
  22.  
  23. switch (menuSelection) //switch statements used to serve the choice of user according to options in menu.
  24. {
  25. case 1:
  26. myHelper.addAFriend();
  27. break;
  28. case 2:
  29. myHelper.changeFriend();
  30. break;
  31. case 3:
  32. myHelper.deleteFriend();
  33. break;
  34. case 4:
  35. myHelper.displayFriend();
  36. break;
  37. case 5:
  38. break;
  39. default:
  40. System.out.println("Invalid Menu Option, Please Try Again.");
  41. }
  42.  
  43. } while (menuSelection != 5);
  44. System.out.println("Goodbye!");
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement