public static void removeMovie() { System.out.println("\n------------------------\n"); System.out.println("List movie of " + currentCineplex.getCineplexName() + "............"); for (int i = 0; i < currentCineplex.getMovieList().size(); i++) { System.out.println(i + 1 + ")"); System.out.printf("%s\n", currentCineplex.getMovieList().get(i).printDescription()); } System.out.println("\n------------------------\n"); System.out.println("which movie to be removed"); int optionRemoveMovie = scan.nextInt(); boolean pass = true; String movieDeleted = currentCineplex.getMovieList().get(optionRemoveMovie - 1).getTitle(); currentCineplex.removeMovie(currentCineplex.getMovieList().get(optionRemoveMovie - 1)); // need to remove the movie from rated movie if there has no such movie again in all the // cineplex for (int i = 0; i < cineplexList.size(); i++) { Cineplex cineplex = cineplexList.get(i); ArrayList<Movie> movieRemovedList = cineplex.getMovieList(); for (int j = 0; j < movieRemovedList.size(); j++) { if (movieRemovedList.get(j).getTitle().equals(movieDeleted)) { // means still has this movie in other cineplex so cannot delete it pass = false; break; } } } if (pass) { movieRated.removeMovie(movieDeleted); } System.out.println("changes has been saved to our system \n"); }