Cinema Room Manager is a console-based Java application that helps manage a cinema theatre. It allows users to visualize the seating arrangement, buy tickets, and view sales statistics. This project was created to learn and apply core Java concepts such as input/output operations, handling arrays, creating functions, and using loops and conditional statements.
- Visualize the seating arrangement.
- Buy tickets by selecting specific seats.
- View cinema statistics, including the number of tickets sold, percentage of seats sold, current income, and potential total income.
- Handle user input errors gracefully.
- Java
The project consists of the following main components:
Cinema
class: The entry point of the application.CinemaHall
class: Handles the core functionality, such as displaying the seating arrangement, managing ticket purchases, and calculating statistics.
-
git clone https://github.com/alibnaqvi/cinema_room_manager.git
-
cd cinema_room_manager/Cinema\ Room\ Manager/task/src/cinema
-
javac Cinema.java CinemaHall.java
-
java Cinema.java
After running the program, you will be prompted to enter the number of rows and seats per row for the cinema:
Enter the number of rows (1-9):
Enter the number of seats in each row (1-9):
The main menu will then be displayed:
1. Show the seats
2. Buy a ticket
3. Statistics
0. Exit
a. Option 1: Displays the current seating arrangement. Available seats are marked with 'S', and sold seats are marked with 'B'.
b. Option 2: Allows you to buy a ticket by selecting a specific row and seat number. The ticket price is determined by the row number.
c. Option 3: Displays the cinema statistics, such as the number of purchased tickets, the percentage of occupancy, current income, and potential total income.
d. Option 0: Exits the application.
Here is an example of the program in action:
- Show the seats
Cinema:
1 2 3 4 5 6
1 S S S S S S
2 S S S S S S
3 S S S S S S
4 S S S S S S
5 S S S S S S
- Buy a ticket
Enter a row number:
3
Enter a seat number in that row:
2
Ticket price: $10
- Statistics
Number of purchased tickets: 1
Percentage: 3.33%
Current income: $10
Total income: $270
If you spot anything wrong with the program or would like to suggest improvements, feel free to email me at ali.b.naqvi@berkeley.edu. Thanks!