Exemplo n.º 1
0
 /** Start. */
 public void start() {
   // Show the list of action that users can choose.
   // To be called by controller.
   // Controller then take the user input and perform the logic functions.
   int userChoice;
   boolean isQuit = false;
   do {
     printUserMenu();
     try {
       userChoice = Integer.parseInt(sc.nextLine());
     } catch (NumberFormatException e) {
       System.out.println("Please enter a valid number!");
       continue;
     }
     switch (userChoice) {
       case 1:
         searchMovie();
         break;
       case 2:
         System.out.println(LINE_SPACING);
         System.out.println("The movie lists: ");
         movieUser.printMovieList();
         break;
       case 3:
         requestMovieDetails();
         break;
       case 4:
         checkSeatsAndBookTicket();
         break;
       case 5:
         viewBookingHistory();
         break;
       case 6:
         addReview();
         break;
       case 7:
         System.out.println(LINE_SPACING);
         System.out.println("Here are top 5 movies by ticket sales: ");
         movieUser.listTopTicketSales();
         break;
       case 8:
         System.out.println(LINE_SPACING);
         System.out.println("Here are top 5 movies by rating: ");
         movieUser.listTopRating();
         break;
       default:
         isQuit = true;
         break;
     }
   } while (!isQuit);
 }