Programming lesson
Movie Theater Manager: Building a Menu-Driven Java Console App
Learn to build a movie theater ticket and confection management system in Java using a menu-driven console app. Perfect for CSE1322 Assignment 1 practice.
Introduction to the Movie Theater Manager Project
In this tutorial, we'll walk through the process of building a Movie Theater Manager console application in Java. This project is inspired by the CSE1322 Assignment 1 (Fall 2025) P0 assignment, where you create a simple program to help a small theater sell movie tickets and confections, track balance, and update prices. By the end of this guide, you'll understand how to implement a menu-driven system with input validation, variable tracking, and basic business logic.
This type of application is a great way to practice Java fundamentals like loops, conditionals, and data types. Plus, it's a fun way to simulate a real-world scenario—similar to how a movie theater POS system works, or even how a gaming microtransaction store manages inventory and pricing.
Setting Up the Project Structure
First, create a new Java class called Assignment1 (or MovieTheaterManager). This will contain your main method. Inside main, you'll declare variables to track:
- Available seats (int): starts at 50
- Ticket price (double): starts at $30.00
- Popcorn price (double): starts at $25.00
- Soda price (double): starts at $10.00
- Candy price (double): starts at $15.00
- Current balance (double): starts at $0.00
Choose data types carefully: use int for whole numbers (seats) and double for monetary values. This is a key concept in Java variable declaration.
Building the Main Menu Loop
Use a while loop to repeatedly display the menu and process user input until the user chooses to quit. The menu options are:
- Sell tickets
- End movie session
- Change ticket price
- Sell confection
- Change price of confection
- View balance
- View prices
- Quit
Prompt the user with System.out.print and read their choice using a Scanner. Use a switch or if-else to handle each option. This is a classic menu-driven program in Java.
Implementing Option 1: Sell Tickets
When the user selects option 1, ask how many tickets they want to sell. Check if there are enough seats available. If yes, update the seats (subtract sold tickets) and add ticketsSold * ticketPrice to the balance. If not, print an error message and do not change any values. This is a great exercise in conditional logic and input validation.
if (ticketsToSell <= availableSeats) {
availableSeats -= ticketsToSell;
balance += ticketsToSell * ticketPrice;
System.out.println("Sold " + ticketsToSell + " tickets for $" + (ticketsToSell * ticketPrice));
} else {
System.out.println("Unable to sell " + ticketsToSell + " tickets: Only " + availableSeats + " seats available.");
}Implementing Option 2: End Movie Session
This option resets the available seats back to 50. It does not affect the balance. Print a confirmation message like "All seats have been vacated and cleaned." This mimics a real theater resetting after a show—similar to how a gaming server resets a match queue.
Implementing Option 3: Change Ticket Price
Prompt the user for a new ticket price (as a double). Update the ticketPrice variable. No validation is required, but you could add a check for negative values for robustness.
Implementing Option 4: Sell Confection
Show a submenu for confections: 1. Popcorn, 2. Soda, 3. Candy. Based on the user's choice, add the corresponding price to the balance and print a confirmation. This is a simple switch statement practice.
System.out.println("Sell what confection? 1. Popcorn 2. Soda 3. Candy");
int confChoice = scanner.nextInt();
switch (confChoice) {
case 1: balance += popcornPrice; System.out.println("Sold POPCORN for $" + popcornPrice); break;
case 2: balance += sodaPrice; System.out.println("Sold SODA for $" + sodaPrice); break;
case 3: balance += candyPrice; System.out.println("Sold CANDY for $" + candyPrice); break;
default: System.out.println("Invalid choice.");
}Implementing Option 5: Change Price of Confection
Show a submenu to choose which confection's price to change. Then prompt for the new price and update the appropriate variable. This reinforces variable updating and nested menus.
Implementing Options 6 and 7: View Balance and View Prices
Option 6 simply prints the current balance. Option 7 prints all current prices (ticket, popcorn, soda, candy). Use System.out.printf for formatted output with two decimal places: System.out.printf("Current balance is $%.2f%n", balance);
Implementing Option 8: Quit
Print a goodbye message and break out of the loop. Use System.exit(0) or set a flag to exit the while loop.
Full Code Structure and Best Practices
Place all logic inside the main method. Use a Scanner for input. Remember to close the scanner when done. This project is an excellent example of Java console application development and is perfect for beginner Java projects.
Testing Your Program
Run your program and test each menu option. Try selling tickets when seats are insufficient, change prices, sell confections, and view balance. Verify that the balance updates correctly. This is a great way to practice debugging Java code.
Connecting to Real-World Trends
Think of this project like a digital box office for a movie theater or even a virtual ticket system for a gaming event. In 2026, many theaters use similar software to manage dynamic pricing and concessions. This project also mirrors how in-app purchases work in mobile games—tracking virtual currency and item prices.
Conclusion
You've now built a fully functional Movie Theater Manager in Java. This project covers core concepts like variables, loops, conditionals, and user input. It's a solid foundation for more complex systems. Keep experimenting by adding features like discount tickets or combo deals. Happy coding!