Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.14 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Menu {
  4.     public static void main(String[] args){
  5.         mainMenuDisplay();
  6.  
  7.     }
  8.    
  9.    
  10.    
  11.    
  12.    
  13.    
  14.    
  15.     /* This Method handles the main menu setup, it accepts user input, then calls
  16.      * the methods that the user requests for the program to complete it's function
  17.      */
  18.     public static void mainMenuDisplay(){
  19.         Scanner input = new Scanner(System.in);
  20.         System.out.println("***** TV Show Application *****");
  21.         System.out.println("Please enter one of the following options;");
  22.         System.out.println("(1) Add a TV Series");
  23.         System.out.println("(2) Edit a TV Series");
  24.         System.out.println("(3) Rate a TV Series");
  25.         System.out.println("(4) Exit the application\n");
  26.         if(input.hasNextInt()){
  27.             int userInput = input.nextInt();
  28.             switch(userInput){
  29.             case 1:
  30.                 addTVShow();
  31.                 mainMenuDisplay();
  32.                 break;
  33.             case 2:
  34.                 editTVShow();
  35.                 break;
  36.             case 3:
  37.                 rateTVShow();
  38.                 break;
  39.             case 4:
  40.                 System.out.println("The Program has been closed!");
  41.                 System.exit(0);
  42.                 break;
  43.             default:
  44.                 System.out.println("*-------------------------------*\n");
  45.                 System.out.println("You did not enter a valid option! \n Please try again!");
  46.                 System.out.println("\n*------------------------------*\n");
  47.                 mainMenuDisplay();
  48.             }
  49.         input.close();
  50.         }
  51.         else {
  52.             System.out.println("*-------------------------------*\n");
  53.             System.out.println("A non-integer has been detected \nPlease try again!");
  54.             System.out.println("\n*------------------------------*\n");
  55.             mainMenuDisplay();}
  56.     }
  57.    
  58.     public static void addTVShow(){
  59.         Scanner input = new Scanner(System.in);
  60.         System.out.println("You have selected to add a TV Show");
  61.         System.out.println("Enter TV Show Title:");
  62.         String tvShowAdd = input.nextLine();
  63.         System.out.println(tvShowAdd);
  64.         System.out.println("Enter the Genre:");
  65.         System.out.println("(1) Comedy  " + "(6) Animation" );
  66.         System.out.println("(2) Action  " + "(7) War"   );
  67.         System.out.println("(3) Horror  " + "(8) Fantasy"   );
  68.         System.out.println("(4) Romance " + "(9) Sci-Fi"    );
  69.         System.out.println("(5) Drama   ");
  70.         tvShowAdd = input.nextLine();
  71.         System.out.println(tvShowAdd);
  72.         input.close();
  73.         System.out.println("Thank you for adding a TV Show");
  74.     }
  75.  
  76.     public static void editTVShow(){
  77.            Scanner input = new Scanner(System.in);
  78.            System.out.println("You have selected to edit a TV Show");
  79.            System.out.println("Please input the ID for the specfic TV Show:");
  80.            int editTVShow = input.nextInt();
  81.            System.out.println("You have selected:" + editTVShow);
  82.            System.out.println("The current TV Show name is: " + editTVShow);
  83.            System.out.println("Input the new TV Show Name");
  84.            String nameTVShow = input.nextLine();
  85.            System.out.println("The name of the of TV Show is now: " + nameTVShow);
  86.            System.out.println("The current Genre is " + editTVShow);
  87.            System.out.println("Enter the  new Genre:");
  88.            System.out.println("(1) Comedy  " + "(6) Animation"  );
  89.            System.out.println("(2) Action  " + "(7) War"    );
  90.            System.out.println("(3) Horror  " + "(8) Fantasy"   );
  91.            System.out.println("(4) Romance " + "(9) Sci-Fi" );
  92.            System.out.println("(5) Drama   ");
  93.            editTVShow = input.nextInt();
  94.            System.out.println("The new Genre is: " + editTVShow);
  95.            input.close();
  96.            System.out.println("Thank you for editing a TV Show");
  97.            mainMenuDisplay();
  98.         }
  99.    
  100.     public static void rateTVShow(){
  101.         Scanner input = new Scanner(System.in);
  102.         System.out.println("You have selected to rate a TV Show");
  103.         System.out.println("Please input the ID for the specfic TV Show:");
  104.         int tvRateAdd = input.nextInt();
  105.         System.out.println("You have selected: " + tvRateAdd);
  106.         System.out.println("Please enter the correct rating: ");
  107.         System.out.println("(1) *");
  108.         System.out.println("(2) **");
  109.         System.out.println("(3) ***");
  110.         System.out.println("(4) ****");
  111.         System.out.println("(5) *****");
  112.         tvRateAdd = input.nextInt();
  113.         System.out.println("You have selected "  + "for the following TVShow: ");
  114.         System.out.println("Thank you for rating a TV Series");    
  115.         input.close();
  116.         mainMenuDisplay();
  117.     }
  118.    
  119.  
  120.    
  121.    
  122.    
  123.    
  124.  
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement