Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.18 KB | None | 0 0
  1. package com.supinfo.javapetstoreconsole.launcher;
  2.  
  3. import java.util.Scanner;
  4.  
  5.  
  6. public class Launch
  7. {
  8.  
  9.     public static void main(String[] args)
  10.     {
  11.         Scanner scanner = new Scanner(System.in);
  12.         int choice = 0;
  13.  
  14.         while(choice != 5) {
  15.             System.out.println(Launch.displayMainMenu());
  16.             choice = scanner.nextInt();
  17.             System.out.println(Launch.computeMainMenuChoice(choice));
  18.         }
  19.     }
  20.  
  21.     public static String displayMainMenu()
  22.     {
  23.         return "1 - Add an item\n"
  24.              + "2 - Update an item\n"
  25.              + "3 - Find an item\n"
  26.              + "4 - Delete an item\n"
  27.              + "5 - Quit";
  28.     }
  29.    
  30.     public static String computeMainMenuChoice(int choice)
  31.     {
  32.         switch(choice) {
  33.             case 1:
  34.                 return "You choose to add an item";
  35.             case 2:
  36.                 return "You choose to update an item";
  37.             case 3:
  38.                 return "You choose to find an item";
  39.             case 4:
  40.                 return "You choose to delete an item";
  41.             case 5:
  42.                 return "You choose to quit";
  43.         }
  44.         return null;
  45.     }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement