Corrected Movie Ticket Booking Project
Corrected Movie Ticket Booking Project
1. Introduction
The Movie Ticket Booking System allows users to book movie tickets, calculates the total price including
GST, and displays booking summaries. It demonstrates Python fundamentals like classes, methods, input
2. Class: MovieTicketBooking
This class manages the entire booking process. It holds data about available movies, GST rate, and
3. Method: __init__
Initializes the system with predefined movies and prices. Also sets the GST rate to 18% and prepares an
4. Method: display_movies
Lists all available movies with their respective ticket prices. Uses enumerate to provide an indexed list.
5. Method: select_movie
Prompts the user to select a movie by entering a number. Includes error handling for invalid inputs and
6. Method: get_ticket_count
Asks the user to specify how many tickets to book. Ensures the input is a positive integer using error
handling.
Movie Ticket Booking System - Project Report
7. Method: calculate_total
Calculates the total ticket cost including GST. Takes the selected movie and number of tickets as input and
8. Method: book_ticket
Handles the end-to-end booking process. Calls other methods to select the movie, get ticket count, and
9. Method: show_bookings
Displays a summary of all bookings made. If no bookings exist, it informs the user.
Acts as the main control loop of the program, providing a menu-driven interface for booking tickets, viewing
Below is the complete source code of the Movie Ticket Booking System, provided for reference and detailed
class MovieTicketBooking:
def __init__(self):
self.movies = {
"Avatar": 300.00,
"Inception": 250.00,
"The Lion King": 200.00,
"Titanic": 180.00
Movie Ticket Booking System - Project Report
}
self.bookings = {}
self.gst_rate = 18
def display_movies(self):
print("Available Movies:")
for idx, (movie, price) in enumerate(self.movies.items(), start=1):
print(f"{idx}. {movie} - Rs {price:.2f}")
def select_movie(self):
while True:
try:
choice = int(input("Enter the movie number to book tickets: "))
if 1 <= choice <= len(self.movies):
return list(self.movies.keys())[choice - 1]
else:
print("Invalid choice. Please choose a valid movie number.")
except ValueError:
print("Invalid input. Please enter a number.")
def get_ticket_count(self):
while True:
try:
tickets = int(input("Enter the number of tickets you want to book: "))
if tickets > 0:
return tickets
else:
print("Please enter a number greater than 0.")
except ValueError:
print("Invalid input. Please enter a valid number of tickets.")
def book_ticket(self):
self.display_movies()
movie = self.select_movie()
ticket_count = self.get_ticket_count()
total_price, gst_amount = self.calculate_total(movie, ticket_count)
self.bookings[movie] = self.bookings.get(movie, 0) + ticket_count
print(f"\nBooking Confirmed!")
print(f"Movie: {movie}")
print(f"Tickets: {ticket_count}")
print(f"GST Amount per Ticket: Rs {gst_amount:.2f}")
print(f"Total Price (Including GST): Rs {total_price:.2f}")
def show_bookings(self):
if not self.bookings:
Movie Ticket Booking System - Project Report
print("No bookings yet.")
else:
print("\nBooking Summary:")
for movie, count in self.bookings.items():
print(f"{movie}: {count} tickets")
def main():
booking_system = MovieTicketBooking()
while True:
print("\nMovie Ticket Booking System")
print("1. Book Tickets")
print("2. Show Bookings")
print("3. Exit")
choice = input("Enter your choice: ")
if choice == "1":
booking_system.book_ticket()
elif choice == "2":
booking_system.show_bookings()
elif choice == "3":
print("Exiting the system. Goodbye!")
break
else:
print("Invalid choice. Please try again.")