Flight
Flight
MATHEW
CLASS:-XII SCIENCE
SUBJECT:-COMPUTER SCIENCE
ROLL NO.:-
TOPIC:- INVESTIGATORY PROJECT ON
FLIGHT BOOKING MANAGEMENT
CERTIFICATE
This is to certify that Shayna Mathew of
class: 12th SCI of SSV GYAN KENDRA
UMARGRAM has done his project on FLIGHT
BOOKING MANAGMENT under my
supervision. He has taken an interest and
has shown utmost sincerity in completion of
this project. I am satisfied with their
initiative and efforts for the completion of
the project file as a part of the curriculum
the CBSE Class XII Examination.
Principal
Acknowledgment
It is with pleasure that I acknowledge my sincere
gratitude to our teacher, MR. Pratyush Singh who
taught and undertook the responsibility of teaching
the subject of computer science. I have been greatly
benefited from his classes. I am especially indebted to
our Principal MR. Ravi Soni who has always been a
source of encouragement and support and without
whose inspiration this project would not have been a
success I would like to place on record heartfelt
thanks to him. Finally, I would like to express my
sincere appreciation for all the other students for my
batch their friendship and the fine time that we all
shared together.
INDEX
SR TOPIC
NO.
1. Source Code
2. Output
3. Bibliography
SOURCE CODE:-
import mysql.connector
from mysql.connector import Error
try:
# Connect to MySQL
connection = mysql.connector.connect(
host="localhost",
user="root",
password="admin",
charset='utf8'
)
if connection.is_connected():
print("Successfully connected to MySQL")
cursor.execute(flight_table_query)
cursor.execute(booking_table_query)
if flight:
update_query = "UPDATE flights SET available_seats =
available_seats - 1 WHERE flight_id = %s"
cursor.execute(update_query, (flight_id,))
connection.commit()
print("\nBooking successful!")
else:
print("\nFlight not available or no seats left.")
connection.commit()
print("\nFlight added successfully!")
# Main menu
while True:
print("\nFlight Ticket Booking Management System")
print("1. Display Available Flights")
print("2. Book a Flight")
print("3. Add a New Flight")
print("4. Exit")
if choice == "1":
display_flights()
elif choice == "2":
flight_id = input("Enter Flight ID: ")
passenger_name = input("Enter Passenger Name: ")
seat_number = input("Enter Seat Number: ")
book_flight(int(flight_id), passenger_name, int(seat_number))
elif choice == "3":
add_flight()
elif choice == "4":
break
else:
print("Invalid choice. Please enter 1, 2, 3, or 4.")
except Error as e:
print(f"Error: {e}")
finally:
if connection.is_connected():
cursor.close()
connection.close()
print("MySQL connection is closed")
Output:-
Bibliography
www.google.com
www.wikipedia.org
Sumita Arora XII