Guest User

Untitled

a guest
Jan 23rd, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.20 KB | None | 0 0
  1.    public static int MainMenu(){
  2.       //Displays the main menu and handles passing off to next menu.
  3.      
  4.         Scanner scanner = new Scanner (System.in);
  5.         int selection=0;
  6.         int x=0;
  7.        
  8.         while(true){   //changed while(1) to a value that didn't complain in netbeans
  9.             System.out.println("Please Make a selection:");
  10.             System.out.println("[1] Add a new record");
  11.             System.out.println("[2] Open an existing record");
  12.             System.out.println("[3] exit");
  13.             System.out.println("Selection: ");
  14.             selection=scanner.nextInt();    
  15.        
  16.        switch (selection){
  17.              
  18.            case 1:System.out.println("Adding new record");
  19.                 x=1;
  20.                 break;
  21.              
  22.        
  23.            case 2:System.out.println("Opening existing record");
  24.                 x=1;
  25.                 break;
  26.              
  27.        
  28.            case 3:System.out.println("Exit Successful");
  29.                 System.exit(0);
  30.                        
  31.            default:System.out.println("Please enter a valid selection.");
  32.            
  33.             };
  34.        
  35.         }  
  36.         return selection;
  37.     }
Add Comment
Please, Sign In to add comment