Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Menu {
- public static void main(String[] args){
- mainMenuDisplay();
- }
- /* This Method handles the main menu setup, it accepts user input, then calls
- * the methods that the user requests for the program to complete it's function
- */
- public static void mainMenuDisplay(){
- Scanner input = new Scanner(System.in);
- System.out.println("***** TV Show Application *****");
- System.out.println("Please enter one of the following options;");
- System.out.println("(1) Add a TV Series");
- System.out.println("(2) Edit a TV Series");
- System.out.println("(3) Rate a TV Series");
- System.out.println("(4) Exit the application\n");
- if(input.hasNextInt()){
- int userInput = input.nextInt();
- switch(userInput){
- case 1:
- addTVShow();
- mainMenuDisplay();
- break;
- case 2:
- editTVShow();
- break;
- case 3:
- rateTVShow();
- break;
- case 4:
- System.out.println("The Program has been closed!");
- System.exit(0);
- break;
- default:
- System.out.println("*-------------------------------*\n");
- System.out.println("You did not enter a valid option! \n Please try again!");
- System.out.println("\n*------------------------------*\n");
- mainMenuDisplay();
- }
- input.close();
- }
- else {
- System.out.println("*-------------------------------*\n");
- System.out.println("A non-integer has been detected \nPlease try again!");
- System.out.println("\n*------------------------------*\n");
- mainMenuDisplay();}
- }
- public static void addTVShow(){
- Scanner input = new Scanner(System.in);
- System.out.println("You have selected to add a TV Show");
- System.out.println("Enter TV Show Title:");
- String tvShowAdd = input.nextLine();
- System.out.println(tvShowAdd);
- System.out.println("Enter the Genre:");
- System.out.println("(1) Comedy " + "(6) Animation" );
- System.out.println("(2) Action " + "(7) War" );
- System.out.println("(3) Horror " + "(8) Fantasy" );
- System.out.println("(4) Romance " + "(9) Sci-Fi" );
- System.out.println("(5) Drama ");
- tvShowAdd = input.nextLine();
- System.out.println(tvShowAdd);
- input.close();
- System.out.println("Thank you for adding a TV Show");
- }
- public static void editTVShow(){
- Scanner input = new Scanner(System.in);
- System.out.println("You have selected to edit a TV Show");
- System.out.println("Please input the ID for the specfic TV Show:");
- int editTVShow = input.nextInt();
- System.out.println("You have selected:" + editTVShow);
- System.out.println("The current TV Show name is: " + editTVShow);
- System.out.println("Input the new TV Show Name");
- String nameTVShow = input.nextLine();
- System.out.println("The name of the of TV Show is now: " + nameTVShow);
- System.out.println("The current Genre is " + editTVShow);
- System.out.println("Enter the new Genre:");
- System.out.println("(1) Comedy " + "(6) Animation" );
- System.out.println("(2) Action " + "(7) War" );
- System.out.println("(3) Horror " + "(8) Fantasy" );
- System.out.println("(4) Romance " + "(9) Sci-Fi" );
- System.out.println("(5) Drama ");
- editTVShow = input.nextInt();
- System.out.println("The new Genre is: " + editTVShow);
- input.close();
- System.out.println("Thank you for editing a TV Show");
- mainMenuDisplay();
- }
- public static void rateTVShow(){
- Scanner input = new Scanner(System.in);
- System.out.println("You have selected to rate a TV Show");
- System.out.println("Please input the ID for the specfic TV Show:");
- int tvRateAdd = input.nextInt();
- System.out.println("You have selected: " + tvRateAdd);
- System.out.println("Please enter the correct rating: ");
- System.out.println("(1) *");
- System.out.println("(2) **");
- System.out.println("(3) ***");
- System.out.println("(4) ****");
- System.out.println("(5) *****");
- tvRateAdd = input.nextInt();
- System.out.println("You have selected " + "for the following TVShow: ");
- System.out.println("Thank you for rating a TV Series");
- input.close();
- mainMenuDisplay();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement