CS FLYTX PROJECT 2024-25 CBSE
CS FLYTX PROJECT 2024-25 CBSE
CS FLYTX PROJECT 2024-25 CBSE
INVESTIGATORY
PROJECT
TOPIC - FLIGHT MANAGMENT AND BOOKING
SYSTEM “FLYTX”
CLASS- XII-S1
2024-25
INDEX
1 CERTIFICATE
2 ACKNOWLEDEGMENT
3 INTRODUCTION TO PROJECT
4 SOURCE CODE
5 DATABSE
6 BIBLIOGRAPHY
CERTIFICATE
SIGNATURE SIGNATURE
EXTERNAL EXAMINER INTERNAL EXAMINER
SIGNATURE OF PRINCIPAL
Acknowledgement
REGISTERATION
def register(cur, a):
name = input("Enter passenger name: ")
phone = int(input("Enter phone number: "))
email = input("Enter email: ")
password = input("Set a password: ")
cur.execute("""
INSERT INTO passengers (name, phone, email, password)
VALUES (%s, %s, %s, %s)
""", (name, phone, email, password))
a.commit()
print("Passenger added successfully! Remember your password for booking
flights")
BOOKING
def book(cur, a):
try:
phone = int(input("Enter your phone number: "))
password = input("Enter your password: ")
cur.execute("SELECT pid FROM passengers WHERE phone = %s AND password
= %s", (phone, password))
passenger = cur.fetchone()
if not passenger:
print("Invalid phone number or password. Please try again.")
return
pid = passenger[0]
departure = input("Enter flight departure place: ")
destination = input("Enter flight destination place: ")
bookdate = input("Enter booking date (YYYY-MM-DD):")
cur.execute("SELECT fid, available_seats FROM flights WHERE departure
= %s AND destination = %s", (departure, destination))
flights = cur.fetchall()
if not flights:
print("No flights available for this route.")
return
fid = flights[0][0]
available_seats = flights[0][1]
AVAILABLE SEATS
if available_seats > 0:
cur.execute("""
INSERT INTO bookings (pid, fid, bookdate)
VALUES (%s, %s, %s)
""", (pid, fid, bookdate))
cur.execute("UPDATE flights SET available_seats = available_seats
- 1 WHERE fid = %s", (fid,))
a.commit()
print("Flight booked successfully!")
else:
print("No available seats on this flight.")
except ValueError:
print("Invalid input. Please enter valid values.")
AVAILABLE FLIGHTS
def show_flights(cur):
cur.execute("SELECT * FROM flights")
flights = cur.fetchall()
print("Available Flights:")
for i in flights: #flight = "i"
print(f"Flight ID: {i[0]}, Flight Name: {i[1]}, Departure: {i[2]},
Destination: {i[3]}, Departure Time: {i[4]}, Arrival Time: {i[5]}, Available
Seats: {i[7]}")
ADMIN INTERFACE
def admin(cur, a):
while True:
print("\nAdmin Menu:")
print("1. Add Flight")
print("2. Show Flights")
print("3. Exit")
try:
choice = int(input("Enter your choice: "))
if choice == 1:
addflight(cur, a)
elif choice == 2:
show_flights(cur)
elif choice == 3:
break
else:
print("Please choose a correct option.")
except ValueError:
print("Invalid choice. Please enter a number.")
USER INTERFACE
def user(cur, a):
while True:
print("\nUser Menu:")
print("1. Register Passenger")
print("2. Book Flight")
print("3. Show Flights")
print("4. Exit")
try:
choice = int(input("Enter your choice: "))
if choice == 1:
register(cur, a)
elif choice == 2:
book(cur, a)
elif choice == 3:
show_flights(cur)
elif choice == 4:
break
else:
print("Please choose a correct option.")
except ValueError:
print("Invalid choice. Please enter a number.")
MAIN
def main():
con = cr_con()
cur = con.cursor()
tb(cur)
while True:
print("\nMain Menu:")
print("1. Admin")
print("2. User")
print("3. Exit")
try:
choice = int(input("Enter your choice: "))
if choice == 1:
admin(cur, con)
elif choice == 2:
user(cur, con)
elif choice == 3:
break
else:
print("Please choose a correct option.")
except ValueError:
print("Invalid choice. Please enter a number.")
con.close()
print("Welcome to the FlyteX Flight Management & Booking System!")
main()
WORKING SCREENSHOTS
➢ MAIN INTERFACE
➢ ADMIN INTERFACE
➢ ADD FLIGHTS
➢ SHOW FLIGHTS
➢ USER INTERFACE
➢ REGISTER PASSENGER
➢ BOOK FLIGHT
➢ SHOW FLIGHTS (AFTER BOOKING)
➢ EXITING
DATABASE (MY SQL)
➢ FLIGHTMANAGE
➢ TABLES
➢ DATA IN BOOKINGS
➢ DATA IN FLIGHTS
➢ DATA IN PASSENGERS