Explore the world of Python programming with 'Complete Python Mastery'! Our repository, led by Pankaj, offers a series of in-depth tutorials under the banner 'Codes with Pankaj.' Dive into hands-on coding examples, insightful explanations, and practical projects as Pankaj guides you through mastering Python.
Python Programming Assignment: Movie Ticket Management System
Objective:
Develop a command-line Movie Ticket Management System using Python. This project will help you practice object-oriented programming, data structures, file handling, and basic algorithms.
Requirements:
Movie Class:
Create a class called 'Movie' with the following attributes:
title (string)
duration (integer, in minutes)
rating (string, e.g., "PG", "PG-13", "R")
show_times (list of datetime objects)
Methods:
init: Initialize the movie object
str: Return a string representation of the movie
add_show_time: Add a new show time for the movie
remove_show_time: Remove a show time for the movie
Theater Class:
Create a class called 'Theater' with the following attributes:
name (string)
capacity (integer)
movies (list of Movie objects)
seats (dictionary mapping show times to lists of available seats)
Methods:
init: Initialize the theater object
add_movie: Add a new movie to the theater
remove_movie: Remove a movie from the theater
display_movies: Show all movies currently playing
display_show_times: Show all show times for a specific movie
book_ticket: Book a ticket for a specific movie and show time
cancel_booking: Cancel a booking for a specific movie and show time
TicketSystem Class:
Create a class called 'TicketSystem' to manage the overall system:
theaters (list of Theater objects)
Methods:
init: Initialize the ticket system
add_theater: Add a new theater to the system
remove_theater: Remove a theater from the system
display_theaters: Show all theaters in the system
save_to_file: Save the system data to a file
load_from_file: Load the system data from a file
Main Program:
Create a main program that does the following:
Initializes a TicketSystem object
Loads existing data from a file (if available)
Presents a menu to the user with the following options:
a. Add a new theater
b. Add a new movie to a theater
c. Display all theaters
d. Display movies in a specific theater
e. Book a ticket
f. Cancel a booking
g. Save and exit
Implements each menu option using the TicketSystem and Theater class methods
Saves the system data to a file before exiting
Error Handling:
Implement proper error handling throughout the program. For example:
Handle file not found errors when loading data
Handle invalid input from users
Prevent overbooking of seats
Handle cases where a movie or theater doesn't exist
Data Persistence:
Use file I/O to save and load the system data. You can use JSON or pickle for data storage.
Example Usage:
Welcome to the Movie Ticket Management System
Add a new theater
Add a new movie to a theater
Display all theaters
Display movies in a specific theater
Book a ticket
Cancel a booking
Save and exit
Enter your choice: 1
Enter theater name: Cineplex
Enter theater capacity: 100
Theater added successfully!
Add a new theater
Add a new movie to a theater
Display all theaters
Display movies in a specific theater
Book a ticket
Cancel a booking
Save and exit
Enter your choice: 2
Enter theater name: Cineplex
Enter movie title: Inception
Enter movie duration (in minutes): 148
Enter movie rating: PG-13
Enter show time (YYYY-MM-DD HH:MM): 2024-09-01 19:30
Movie added successfully!
Add a new theater
Add a new movie to a theater
Display all theaters
Display movies in a specific theater
Book a ticket
Cancel a booking
Save and exit
Enter your choice: 5
Enter theater name: Cineplex
Enter movie title: Inception
Enter show time (YYYY-MM-DD HH:MM): 2024-09-01 19:30
Enter number of tickets: 2
Tickets booked successfully!
Add a new theater
Add a new movie to a theater
Display all theaters
Display movies in a specific theater
Book a ticket
Cancel a booking
Save and exit
Enter your choice: 7
System data saved. Goodbye!
Bonus Challenges (Optional):
Implement a user authentication system with different privileges for admins and customers.
Add a feature to generate reports (e.g., most popular movies, theater occupancy rates).
Implement a simple recommendation system based on user booking history.
Create a basic GUI using a library like Tkinter or PyQt.
Submission Instructions:
Submit your Python script(s) with clear comments explaining your code.
Include a brief README file explaining how to run your program and any dependencies required.
If you've implemented any bonus challenges, describe them in your README.
Evaluation Criteria:
Correct implementation of all required features
Proper use of object-oriented programming principles
Effective error handling and input validation
Code organization, readability, and comments
Proper file handling for data persistence
Efficient algorithms for seat allocation and booking management
Bonus points for implementing extra features or optimizations
Python Programming Assignment: Movie Ticket Management System
Objective: Develop a command-line Movie Ticket Management System using Python. This project will help you practice object-oriented programming, data structures, file handling, and basic algorithms.
Requirements:
Movie Class: Create a class called 'Movie' with the following attributes:
Methods:
Theater Class: Create a class called 'Theater' with the following attributes:
Methods:
TicketSystem Class: Create a class called 'TicketSystem' to manage the overall system:
Methods:
Main Program: Create a main program that does the following:
Error Handling: Implement proper error handling throughout the program. For example:
Data Persistence: Use file I/O to save and load the system data. You can use JSON or pickle for data storage.
Example Usage:
Welcome to the Movie Ticket Management System
Enter theater name: Cineplex Enter theater capacity: 100
Theater added successfully!
Enter theater name: Cineplex Enter movie title: Inception Enter movie duration (in minutes): 148 Enter movie rating: PG-13 Enter show time (YYYY-MM-DD HH:MM): 2024-09-01 19:30
Movie added successfully!
Enter theater name: Cineplex Enter movie title: Inception Enter show time (YYYY-MM-DD HH:MM): 2024-09-01 19:30 Enter number of tickets: 2
Tickets booked successfully!
System data saved. Goodbye!
Bonus Challenges (Optional):
Submission Instructions:
Evaluation Criteria: