コード例 #1
0
 private static DateMovie addDateOnNewMovie(String title) {
   int year, month, day, hour, minute;
   DateMovie dateMovie;
   String status;
   System.out.println("insert the date: ");
   System.out.print("Year(YYYY): ");
   year = scan.nextInt();
   System.out.print("Month(MM): ");
   month = scan.nextInt();
   System.out.print("Day(DD): ");
   day = scan.nextInt();
   System.out.print("Hour(hh): ");
   hour = scan.nextInt();
   System.out.print("Minute(mm): ");
   minute = scan.nextInt();
   scan.nextLine();
   DateMovie checkHolidayDate = new DateMovie(year, month, day);
   System.out.println("insert the status of the movie on that time");
   status = chooseStatusMovie();
   System.out.println(
       "insert the cinema that will be playing "
           + title
           + " on "
           + checkHolidayDate.getYearMonthDay());
   int cinemaoption = getIndexCinema();
   Cinema cinema = currentCineplex.getCinema(cinemaoption - 1);
   dateMovie = new DateMovie(cinema, status, year, month, day, hour, minute);
   return dateMovie;
 }
コード例 #2
0
 private static int getIndexCinema() {
   for (int i = 0; i < currentCineplex.getCinemaList().size(); i++) {
     System.out.printf("%d) %s\n", i + 1, currentCineplex.getCinema(i).getCinemaName());
   }
   System.out.println("please choose which cinema ");
   int choosenCinema = scan.nextInt();
   if (choosenCinema > currentCineplex.getCinemaList().size()) {
     System.out.println("Sorry your cinema option is invalid");
     System.out.println("Please choose again");
     return getIndexCinema();
   }
   return choosenCinema;
 }
コード例 #3
0
 private static void editStatusTimeCinema() {
   System.out.println("Schedule " + currentMovie.getTitle() + " :");
   currentMovie.getListDateStatusMovie();
   System.out.println("\n");
   ArrayList<DateMovie> listMovie = currentMovie.getArrayListOfDateMovie();
   System.out.println("Please choose which date you want to configure");
   int indexListMovie = scan.nextInt();
   DateMovie currentDate = listMovie.get(indexListMovie - 1);
   System.out.println(
       "\nPlease choose which one you want to edit on " + currentDate.getStatusTimeMovie());
   System.out.println("1) Time");
   System.out.println("2) status");
   System.out.println("3) cinema");
   int timestatus = scan.nextInt();
   if (timestatus == 1) {
     editTime(listMovie.get(indexListMovie - 1));
   } else if (timestatus == 2) {
     System.out.println("insert the new Status");
     scan.nextLine();
     String newStatus = chooseStatusMovie();
     currentDate.setStatus(newStatus);
     if (!newStatus.equals("Coming Soon")) {
       movieRated.addMovieList(currentMovie);
     }
   } else if (timestatus == 3) {
     System.out.println("List Cinema: ");
     int choosenCinema = getIndexCinema();
     currentDate.setCinema(currentCineplex.getCinema(choosenCinema - 1));
   } else {
     System.out.println("Sorry your choice is not listed in the system");
     System.out.println("Please choose the below option");
     System.out.println("1) Quit to Date configuration");
     System.out.println("2) Editing Date attribute again");
     int option = scan.nextInt();
     if (option == 1) {
       return;
     } else if (option == 2) {
       System.out.println("");
       editStatusTimeCinema();
       return;
     }
     return;
   }
 }
コード例 #4
0
 private static void setNewDateOfMovie(Movie chooseMovie) {
   System.out.println("insert the new date with format");
   System.out.print("YYYY: ");
   int year = scan.nextInt();
   System.out.print("MM: ");
   int month = scan.nextInt();
   System.out.print("DD: ");
   int day = scan.nextInt();
   System.out.print("HH: ");
   int hour = scan.nextInt();
   System.out.print("mm: ");
   int minute = scan.nextInt();
   DateMovie datemovie = new DateMovie(year, month, day, hour, minute);
   System.out.println("insert status to this new Date " + datemovie.getTime());
   scan.nextLine();
   String newStatus = chooseStatusMovie();
   System.out.println("specify which cinema that will play on " + datemovie.getYearMonthDay());
   int cinemaoption = getIndexCinema();
   Cinema cinema = currentCineplex.getCinema(cinemaoption - 1);
   datemovie.setStatus(newStatus);
   datemovie.setCinema(cinema);
   currentMovie.setTimeStatus(datemovie);
   System.out.println("\nYour change has been saved to our system\n");
 }