예제 #1
0
  public static void printMovie(ReadMovie rm) {

    Scanner sc = new Scanner(System.in);
    MovieSerializer serializer = new MovieSerializer();

    System.out.print("\nPlease enter the movie name: ");

    String movieName = sc.nextLine();

    Movie mov = serializer.deSerializeMovie(movieName);

    if (mov == null) {
      System.out.println("Failed to find movie...Please enter available movie!");
      return;
    }

    mov.printMovieDetail();
  }
예제 #2
0
  public static void comingSoonMovieDetail(Movie movie) {
    Scanner sc = new Scanner(System.in);
    int choice = -1;

    while (choice != 0) {
      System.out.println("\n===== " + movie.getMovieTitle() + " =====\n");
      movie.printMovieDetail();
      System.out.println("\n0: Exit");
      System.out.println("What do you want to do?");
      choice = sc.nextInt();
      switch (choice) {
        case 0:
          break;
        default:
          System.out.println("Please input a valid option!");
      }
    }
  }
예제 #3
0
  public static User movieDetail(Movie movie, User user, ReadMovie rm, ReadCineplex rc) {
    Scanner sc = new Scanner(System.in);
    int choice = -1;

    while (choice != 0) {
      System.out.println("\n===== " + movie.getMovieTitle() + " =====\n");
      movie.printMovieDetail();
      System.out.println("\n1: View session");
      System.out.println("2: Buy tickets");
      System.out.println("3: Rate this movie");
      System.out.println("0: Exit");
      System.out.println("What do you want to do?");
      choice = sc.nextInt();

      switch (choice) {
        case 1:
          Cineplex cine = CineplexApp.pickCine(rc);
          cine.printSessionForUser(movie);
          break;
        case 2:
          if (user == null) {
            System.out.println("You have to log in to buy the movie ticket!");
            user = UserApp.getUser(UserApp.userAccount(user));
          }
          if (user == null) break;
          MainApp.buyTicket(movie, user, rc);
          break;
        case 3:
          if (user == null) {
            System.out.println("You have to log in to rate the movie!");
            user = UserApp.getUser(UserApp.userAccount(user));
          }
          if (user == null) break;
          addMovieReview(user, movie);
          break;
        case 0:
          break;
        default:
          System.out.println("Please input a valid option!");
      }
    }
    return user;
  }