Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class BestFriendsArrayList //calls all the methods after prompting the menu options.
- {
- public static void main(String[] args) {
- BestFriendArrayListHelper myHelper = new BestFriendArrayListHelper();
- Scanner sc = new Scanner(System.in);
- System.out.println("Welcome to the friend phone book!\n ");
- int menuSelection = 0;
- do {
- System.out.println("\n1. Add a friend"); //default menu options from user to choose from
- System.out.println("\n2. Change a friend's contact info");
- System.out.println("\n3. Remove a friend's contact info");
- System.out.println("\n4. Display a friend's contact info");
- System.out.println("\n5. Exit menu");
- System.out.print("Please make a selection: ");
- menuSelection = sc.nextInt();
- switch (menuSelection) //switch statements used to serve the choice of user according to options in menu.
- {
- case 1:
- myHelper.addAFriend();
- break;
- case 2:
- myHelper.changeFriend();
- break;
- case 3:
- myHelper.deleteFriend();
- break;
- case 4:
- myHelper.displayFriend();
- break;
- case 5:
- break;
- default:
- System.out.println("Invalid Menu Option, Please Try Again.");
- }
- } while (menuSelection != 5);
- System.out.println("Goodbye!");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement