0% found this document useful (0 votes)
9 views24 pages

Theatre Management System Project

Uploaded by

vlogscurious
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views24 pages

Theatre Management System Project

Uploaded by

vlogscurious
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

BVM GLOBAL BOLLINENI HILLSIDE

SENIOR SECONDARY SCHOOL


CHENNAI – 600131

ACADEMIC YEAR: 2024 – 25


SUBJECT : COMPUTER SCIENCE

SUB CODE : 083

PROJECT TITLE : THEATRE MANAGEMENT SYSTEM

STUDENT NAME : SAHANA RAJESH

CLASS & SEC : XII C

ROLLNO :

TEACHER & GUIDE : MS. LEKSHMI PRIYESH


BVM GLOBAL BOLLINENI HILLSIDE
SENIOR SECONDARY SCHOOL
CHENNAI – 600131

BONAFIde CERTIFICATE
This is to certify that the project has been successfully completed by

SAHANA RAJESH, Roll no ……………………of class XII C, BVM

Global Bollineni Hillside Senior Secondary School, for the partial

fulfilment of this project as a part of Senior School Certificate

Examination for the academic year 2024 - 25.

Date: …………………….

INTERNAL EXAMINER PRINCIPAL EXTERNAL EXAMINER


ACKNOWLEDGEMENT

I express my gratitude to Ms Lekshmi Priyesh, my computer

science teacher and guide, who guided me through the project

and also gave suggestions and guidance for completing the

project. She helped me to understand the intricate issues

involved in making the project, besides effectively presenting

it. These intricacies would have been lost otherwise. My

project has been a success only because of her guidance.


TABLE OF CONTENTS

SLNO DESCRIPTION PAGE NO

01 ABSTRACT 1

02 SYSTEM REQUIREMENTS 1

INTRODUCTION TO PYTHON, MYSQL


03 2
AND CONNECTIVITY

04 LIBRARIES USED 6

05 USER DEFINED FUNCTIONS USED 6

06 MYSQL QUERIES USED 7

07 SOURCE CODE 8

08 OUTPUT 20

09 CONCLUSION 23

10 BIBLIOGRAPHY 24
ABSTRACT:
This Airline Fleet Management System, developed using MySQL and Python, is
designed to enhance the organization and monitoring of an airline's fleet. Each
aircraft, identified by its registration number, is tracked for specifications, usage,
and maintenance history. MySQL serves as the database backbone, storing
essential data for fleet inventory, while Python manages data interactions and
provides an intuitive interface for users. Key features include real-time data
retrieval, maintenance scheduling, and operational performance tracking, aimed at
optimizing fleet efficiency and ensuring smooth airline operations. This project
combines database management and programming to address the complexities of
modern fleet management.

SYSTEM CONFIGURATION :

HARDWARE CONFIGURATION :

Microsoft windows 10 professional/windows 8/windows 8.2:

 Processor : Intel Core i5 or equivalent

 Memory : 2 GB (32-bit), 4 GB (64-bit)

 Disk space : 1.5 GB of free disk space

SOFTWARE REQUIREMENTS

 Python Interpreter
 MySQL

INTRODUCTION :
1
PYTHON:

Python is a high-level, interpreted scripting language developed in the late 1980s


by Guido van Rossum at the National Research Institute for Mathematics and
Computer Science in the Netherlands. The initial version was published at the
outsources newsgroup in 1991, and version 1.0 was released in 1994.

Python 2.0 was released in 2000, and the 2.x versions were the prevalent releases
until December 2008. At that time, the development team made the decision to
release version 3.0, which contained a few relatively small but significant changes
that were not backward compatible with the 2.x versions. Python 2 and 3 are very
similar, and some features of Python 3 have been back ported to Python 2. But in
general, they remain not quite compatible.

Both Python 2 and 3 have continued to be maintained and developed, with periodic
release updates for both. As of this writing, the most recent versions available are
2.7.15 and 3.6.5. However, an official End of life of January 1, 2020 has been
established for Python 2, after which time it will no longer be maintained. If you
are a newcomer to Python, it is recommended that you focus on Python 3, as this
tutorial will do.

2
MYSQL :
Database Management System & Types of DBMS:

A Database Management System (DBMS) is a software application that interacts


with the user, applications and the database itself to capture and analyze data. The
data stored in the database can be modified, retrieved and deleted, and can be of
any type like strings, numbers, images etc.

Object-oriented DBMS: This type of DBMS uses small individual software called
objects. Each object contains a piece of data, and the instructions for the actions to
be done with the data.

Structured Query Language (SQL)


SQL is the core of a relational database which is used for accessing and managing
the database. By using SQL, you can add, update or delete rows of data, retrieve
subsets of information, modify databases and perform many actions. The different
subsets of SQL are as follows:

 DDL (Data Definition Language) –It allows you to perform various


operations on the database such as CREATE, ALTER and DELETE objects.
 DML (Data Manipulation Language)– It allows you to access and
manipulate data. It helps you to insert, update, delete and retrieve data from
the database.
 DCL (Data Control Language)– It allows you to control access to the
database. Example – Grant or Revoke access permissions.
 TCL(Transaction Control Language) – It allows you to deal with the
transaction of the database. Example – Commit, Rollback, Savepoint, Set
Transaction.

3
Python MySQL Database Connection:
Arguments required to connect MySQL from Python

You need to know the following details of the MySQL server to perform the
connection from Python.

 Username – i.e., the username that you use to work with MySQL Server.
The default username for the MySQL database is a root
 Password – Password is given by the user at the time of installing the
MySQL database. If you are using root, then you won’t need the password.
 Host Name – is the server’s name or IP address on which MySQL is
running. if you are running on localhost, then you can use localhost, or it’s
IP, i.e. [Link]
 Database Name – Database name to which you want to connect.
READ Operation

READ Operation on any database means to fetch some useful information from
the database.

Once our database connection is established, you are ready to make a query into
this database. You can use either fetchone() method to fetch single record or
fetchall() method to fetch multiple values from a database table.

fetchone () − It fetches the next row of a query result set. A result set is an
object that is returned when a cursor object is used to query a table.

fetchall () − It fetches all the rows in a result set. If some rows have
already been extracted from the result set, then it retrieves the remaining
rows from the result set.
4
DATABASE CONNECTIVITY:

Steps to connect MySQL database in Python using MySQL


Connector Python

1. Install MySQL Connector Python using pip.

2. Use the [Link]()method of MySQL Connector Python


with required parameters to connect MySQL.

3. Use the connection object returned by a connect()method to create a cursor


object to perform Database Operations.

4. [Link]()to execute SQL queries from Python.

5. Close the Cursor object using a [Link]() and MySQL database


connection using [Link]() after your work completes.

6. Catch Exception if any that may occur during this process.

5
LIBRARIES AND FUNCTIONS USED:

1. [Link] ( ) : The [Link] module


in Python allows connecting to a MySQL database to execute
queries and manage data.
2. TABULATE : The tabulate function in Python displays data
in a clean, readable table format, improving data readability.

USER DEFINED FUNCTIONS USED:


Create_tables() : to create the database and tables
Add_aircraft(): to add aircrafts to a table
Update_aircraft(): to update details of the aircraft
View_all_aircraft(): to view the list of all aircrafts
View_specific_aircraft(): to view the details of a single aircraft
Delete_aircraft(): to delete the aircraft from the table
Add_flight_schedule(): to add a flight route
View_flight_schedule(): to view all flight routes
Add_crew(): to add new crew members
View_crew():to view the details of existing crew members
Maintenance_log(): to log a maintenance record

6
View_maintenance_tracking(): to view past maintenance
records
Aircraft_menu(): to perform operations related to the aircraft
Crew_menu(): to perform operations related to the crew
Schedule_menu(): to perform operations related to the routes
Maintenance (): to perform operations related to maintenance
Main_menu(): to display main options for users

MYSQL QUERIES USED:


import [Link] as sql
con = [Link](host = "localhost", user = "root", passwd
= "*******")
cur = [Link]()
[Link]("create database PythonDB2")
[Link]()

7
SOURCE CODE :

Import [Link]

def create_connection():
conn = [Link](
host="localhost",
user="root",
password="sql#123",
database="book_my_show"
)
return conn

def add_movie():
# Prompt for admin username and password
username = input("Enter admin username: ")
password = input("Enter admin password: ")

connection = create_connection()
cursor = [Link]()

# Check if the admin credentials are valid


8
query = "SELECT * FROM admins WHERE username = %s AND
password = %s"
[Link](query, (username, password))

if [Link]() is None:
print("Access denied. Invalid username or password.")
[Link]()
[Link]()
return

print("Admin authenticated successfully.")

title = input("Enter movie title: ")


genre = input("Enter movie genre: ")
duration = int(input("Enter movie duration (in minutes): "))
release_date = input("Enter release date (YYYY-MM-DD): ")

movie_query = "INSERT INTO Movies (title, genre, duration,


release_date) VALUES (%s, %s, %s, %s)"
movie_values = (title, genre, duration, release_date)
[Link](movie_query, movie_values)
[Link]()

movie_id = [Link]

9
theater_id = int(input("Enter theater ID for the show: "))

show_query = "INSERT INTO Shows (movie_id, theater_id)


VALUES (%s, %s)"
show_values = (movie_id, theater_id)
[Link](show_query, show_values)
[Link]()

show_id = [Link]

for seat_number in range(1, 31):


seat_query = "INSERT INTO Seats (show_id, seat_number,
is_booked) VALUES (%s, %s, FALSE)"
[Link](seat_query, (show_id, seat_number))
[Link]()

print(f"Movie '{title}' added successfully with 30 seats created in


theater ID {theater_id}.")

[Link]()
[Link]()

def view_shows():
conn = create_connection()
cursor = [Link]()

10
query = """
SELECT Shows.show_id, [Link], [Link], [Link]
FROM Shows
JOIN Movies ON Shows.movie_id = Movies.movie_id
JOIN Theaters ON Shows.theater_id = Theaters.theater_id
ORDER BY Shows.show_id
"""

[Link](query)

for show in [Link]():


show_id, title, genre, theater_name = show
print(f"Show ID: {show_id}, Title: {title}, Genre: {genre},
Theater: {theater_name}")

[Link]()

def book_seat(user_id, show_id):


conn = create_connection()
cursor = [Link]()

while True:
[Link]("SELECT seat_id, seat_number FROM Seats
WHERE show_id = %s AND is_booked = FALSE", (show_id,))
11
available_seats = [Link]()

if not available_seats:
print(f"No available seats for show_id {show_id}.")
[Link]()
return

available_seat_map = {seat[1]: seat[0] for seat in available_seats}


available_seat_numbers = list(available_seat_map.keys())

print("Available seats for booking:", ', '.join(map(str,


available_seat_numbers)))

num_members = int(input("Enter the number of members (seats)


you want to book: "))

if num_members > len(available_seat_numbers):


print(f"Sorry, you can only book up to
{len(available_seat_numbers)} seats.")
continue

booked_seats = []
for i in range(num_members):
seat_number = input(f"Enter the Seat Number for member {i+1}
(from available seats): ")

12
try:
seat_number = int(seat_number)
if seat_number not in available_seat_numbers:
print(f"Seat {seat_number} is not available or invalid.")
continue
except ValueError:
print("Invalid input. Please enter a valid seat number.")
continue

seat_id = available_seat_map[seat_number]
[Link]("SELECT is_booked FROM Seats WHERE
seat_id = %s", (seat_id,))
seat = [Link]()

if seat and seat[0]:


print(f"Seat {seat_number} (ID: {seat_id}) is already
booked.")
continue

booked_seats.append(seat_id)

try:

13
[Link]("UPDATE Seats SET is_booked = TRUE
WHERE seat_id = %s", (seat_id,))
[Link]("INSERT INTO Bookings (user_id, show_id,
seat_id) VALUES (%s, %s, %s)",
(user_id, show_id, seat_id))
[Link]()
print(f"Seat {seat_number} (ID: {seat_id}) booked
successfully for user {user_id}.")
except Exception as e:
print(f"An error occurred while booking seat {seat_number}:
{e}")
[Link]()

if booked_seats:
amount = 200.00 * len(booked_seats)
process_payment(user_id, amount, conn)
print(f"Thank you for booking {len(booked_seats)} seat(s)! Your
booking is confirmed.")
else:
print("No seats were successfully booked.")

[Link]()
return

def process_payment(user_id, amount, conn):


14
payment_method = input("Enter payment method (e.g., 'Credit Card',
'PayPal'): ")
cursor = [Link]()

try:
[Link]("INSERT INTO Payments (user_id, amount,
payment_method) VALUES (%s, %s, %s)",
(user_id, amount, payment_method))
[Link]()
print(f"Payment of {amount} processed successfully via
{payment_method}.")
except Exception as e:
print(f"An error occurred while processing the payment: {e}")
[Link]()
finally:
[Link]()

def main():
while True:
print("\n--- Book My Show Menu ---")
print("1. Add Movie (Admin Only)")
print("2. View Shows")
print("3. Book Seat")
print("4. Exit")

15
choice = input("Enter your choice: ")

if choice == "1":
add_movie()
elif choice == "2":
view_shows()
elif choice == "3":
user_id = int(input("Enter user ID: "))
show_id = int(input("Enter show ID: "))
book_seat(user_id, show_id)
elif choice == "4":
print("Exiting the program.")
break
else:
print("Invalid choice. Please try again.")

if _name_ == "_main_":
main()

OUTPUT:
Main menu:
16
Theatre management:

Book seat :

17
18
19
CONCLUSION :
This project is well designed and developed, making sure it is simple and user-
friendly, and at the same time, safe and encrypted. It’s main purpose and goal is to
enhance the organization and monitoring of an airline's fleet.

BIBLIOGRAPHY :
Computer Science with Python by Sumita Arora for Class 11& 12

[Link]

[Link]

[Link]

[Link]

20

You might also like