Movie Theater Management System
This is a Java project that allows the user to manage a movie theater. The project consists of four classes: Main, Venue, Theater, Seat,Movie, and Showtime.
The Main class contains the main method and is responsible for the user interface and interaction. It presents a menu with various options, such as adding and removing movies and showtimes, buying tickets, and viewing movie and seating information. The Main class also uses The Movie Database (TMDB) API to fetch movie details and populate the Movie objects.
The Theater class represents a movie theater. It has several attributes, including a list of Movie objects, a list of Showtime objects, and a two-dimensional array of Seat objects. The Theater class has several methods that allow the user to add, remove, and view movies, showtimes, and seating information. It also has methods that allow the user to buy tickets and find movies and showtimes by title, time, and date.
The Seat class represents a seat in a movie theater. It has several attributes, including the seat's row and column number, and a boolean indicating whether the seat is available or not. The Seat class has several getter and setter methods that allow the user to access and modify these attributes.
The Movie class represents a movie. It has several attributes, including the movie's title, release year, director, duration, and genre. The Movie class has several getter and setter methods that allow the user to access and modify these attributes.
The Showtime class represents a showtime for a movie in a movie theater. It has several attributes, including the Movie object for the movie, the showtime's time and date, and the ticket price. The Showtime class has several getter and setter methods that allow the user to access and modify these attributes.
The Venue class is a simple class that represents a venue such as a theater, stadium, or arena. It has name and location attributes and corresponding get and set methods. It is intended to be used as a base class that other classes such as Theater can extend to inherit its attributes and methods.
Demonstration
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 1
Enter the movie title: Avatar
Enter the director: James Cameron
Enter the duration: 162
Movie added successfully!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 1
Enter the movie title: Avatar
Enter the director: James Cameron
Enter the duration: 162
Movie added successfully!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 1
Enter the movie title: The Godfather
Enter the director: Francis Ford Coppola
Enter the duration: 175
Movie added successfully!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 4
Title: Avatar
Director: James Cameron
Release Year: 2009-12-15
Review: In the 22nd century, a paraplegic Marine is dispatched to the moon Pandora on a unique mission, but becomes torn between following orders and protecting an alien civilization.
Genre: [Action, Adventure, Fantasy, Science Fiction]
Duration: 162
Rating: 7.569
Number of Ratings: 28872
Title: The Godfather
Director: Francis Ford Coppola
Release Year: 1972-03-14
Review: Spanning the years 1945 to 1955, a chronicle of the fictional Italian-American Corleone crime family. When organized crime family patriarch, Vito Corleone barely survives an attempt on his life, his youngest son, Michael steps in to take care of the would-be killers, launching a campaign of bloody revenge.
Genre: [Drama, Crime]
Duration: 175
Rating: 8.711
Number of Ratings: 17735
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 5
Enter the title of the movie: The Godfather
Enter the time of the showtime (e.g. 7:00 PM): 6:00 PM
Enter the date of the showtime (e.g. 2022-12-15): 2023-04-14
Enter the ticket price for the showtime: 30
Showtime added successfully!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 5
Enter the title of the movie: The Godfather
Enter the time of the showtime (e.g. 7:00 PM): 9:00 AM
Enter the date of the showtime (e.g. 2022-12-15): 2023-04-15
Enter the ticket price for the showtime: 40
Showtime added successfully!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 8
Movie: The Godfather
Time: 6:00 PM
Date: 2023-04-14
Price: 30.0
Movie: The Godfather
Time: 9:00 AM
Date: 2023-04-15
Price: 40.0
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 9
Enter the movie title: The Godfather
Enter the showtime (time): 6:00 PM
Enter the showtime (date): 2023-04-14
Enter the seat (row and column): 3 5
Ticket bought!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 10
Enter the movie title: The Godfather
Enter the showtime (time): 6:00 PM
Enter the showtime (date): 2023-04-14
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [X] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 9
Enter the movie title: The Godfather
Enter the showtime (time): 6:00 PM
Enter the showtime (date): 2023-04-14
Enter the seat (row and column): 3 4
Ticket bought!
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 10
Enter the movie title: The Godfather
Enter the showtime (time): 6:00 PM
Enter the showtime (date): 2023-04-14
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [X] [X] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
[O] [O] [O] [O] [O] [O] [O] [O] [O] [O]
Welcome to the LUT Kino at Yliopistonkatu!
1. Add a movie
2. Remove a movie
3. View a movie
4. View all movies
5. Add a showtime
6. Remove a showtime
7. View a showtime
8. View all showtimes
9. Buy a ticket
10. View seating
0. Exit
Enter your choice: 0
Goodbye!
Object-Oriented Programming Principles
The project uses the four principles of object-oriented programming (OOP):
-
The principle of Abstraction is used in the
Movie,Showtime, andSeatclasses, which provide a high-level interface for working with movie, showtime, and seat objects. This allows the user to interact with these objects without having to worry about the underlying details of their implementation. -
The principle of Encapsulation is used in the
Movie,Showtime, andSeatclasses, which define their attributes as private and provide public getter and setter methods for accessing and modifying these attributes. This allows the class to control how its attributes can be accessed and modified, which can help prevent data corruption and maintain the integrity of the objects. -
The principle of Inheritance is used in the
Theaterclass, which extends theVenueclass. This allows the Theater class to inherit the attributes and methods of theVenueclass, which makes it easier to access the name and the location of the theater. -
The principle of Polymorphism is used in the
Theaterclass, which contains a list ofMovieobjects and a list ofShowtimeobjects. This allows theTheaterclass to treat these objects as if they were of the same type, which allows it to use the same methods (such as add and remove) to manage both types of objects.
Notes
- This solution is intended to be a reference only. It is not intended to be a complete solution that will work for all possible inputs. It is possible to break the program by entering invalid inputs or by modifying the data files directly. The program is not intended to be robust enough to handle all possible inputs or to recover from all possible errors.
- The project uses the The Movie Database (TMDB) API to fetch movie details and populate the
Movieobjects. The API key is stored in theAPI_KEYvariable. To run the project, you must set this variable to your TMDB API key. You can get an API key by signing up for a free TMDB account. - JSON files are used to handle the data obtained using the API. Make sure to add the
json-xxx.jarfile to the project's classpath. - The
TmdbExampleclass is used to test the TMDB API. It is not part of the project. It is included in the project only for testing purposes.
Future plans
- Add a GUI