Airport Management-Rithika Python Project
Airport Management-Rithika Python Project
BALAKRISHNA SCHOOL
Vadakkankulam, Tirunelveli District, Tamil Nadu 627116
CBSE/AFFILIATION/1930738
SESSION: 2024-2025
A PROJECT REPORT ON
AIRPORT MANAGEMENT
Principal
ACKNOWLEDGMENT
import random
x=ms.connect(host='localhost',user='root',passwd='root',database='airport')
if x.is_connected():
try:
cur=x.cursor()
print('database created')
except:
pass
#table creation
try:
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
print('table created')
cur.execute('create table TICKET2(DATE_OF_BOOKING DATE NOT
NULL,SOURCE VARCHAR(3) NOT NULL,DESTINATION VARCHAR(3) NOT
NULL,CLASS VARCHAR(15) NOT NULL,PRICE INT,TICKET_NUMBER
CHAR(20),PRIMARY KEY(DATE_OF_BOOKING, SOURCE, DESTINATION,
CLASS))')
print('table created')
print('table created')
print('table created')
print('table created')
x.commit()
except:
pass
try:
cur.execute("insert into
AIRPORT_DETAILS(AP_NAME,STATE,COUNTRY,CNAME,A_CODE)
VALUES('Louisville International Airport','Kentucky','United
States','Louisville','LIA'),('Chandigarh International
Airport','Chandigarh','India','Chandigarh','CGI'),('George Bush Intercontinental
Airport','Texas','United States','Houston','GBI'),('Indira Gandhi International
Airport','Delhi','India','Delhi','IGI'),('Chhatrapati Shivaji International
Airport','Maharashtra','India','Mumbai','CSI'),('San Francisco International
Airport','California', 'United States','San Francisco','SFI'),('Frankfurt
Airport','Hesse','Germany','Frankfurt','FFA'),('John F. Kennedy International
Airport','New York','United States','New York City','JKI'),('Tampa International
Airport','Florida', 'United States','Tampa','TMP'),('Tokyo International
Airport','Tokyo','Japan','Ota city','TIA'),('Velana International Airport','Hulhule
Island','Sri Lanka','Maldives','VIA'),('Zurich International
Airport','Kloten','Europe','Zurich','ZIA'),('Suvarnabhumi International
Airport','Samut Prakan','Thailand','Bangkok','SIA'),('Netaji Subhash ChandraBose
International Airport','Delhi','India','Kolkata','NSC'),('Lokpriya Gopinath Bordoloi
Internation Airport','Delhi','India','Guwahati','LGB'),('Kuala Lumpur International
Airport','Selangor','Malaysia','Kuala Lumpur,'KLI'),('Incheon International
Airport','South korea','South korea','Seoul','IIA'),('Guru Ram Dass Je International
Airport','Delhi','India','Amristar','GRD'),('Dubai International Airport','Abu
Dhabi','United Arab Emirates','Dubai','DIA'),('Dallas/Fort Worth International
Airport','Texas','United States','Forth Worth','DFW'),('Chennai International
Airport','Tamil Nadu','India','Chennai','CIA'),('Chengdu Shuangliu International
Airport','West China','China','Chengdu','CSI')")
cur.execute("insert into
PASSENGER2(PASSPORTNO,FNAME,LNAME,ADDRESS,PHONE,AGE,SEX,PID)v
alues('A1234568','ALEN','SMITH','2230 NORTHSIDE APT 11 ALBANY
NY','8080367290',30,'M',2),('B9876541','ANKITA','AHIR','3456 VIKASAPTS APT
102 DOMBIVLI
INDIA','8080367280',26,'F',4),('C2345698','KHYATI','MISHRA','7820 MCCALLUM
COURTS APT 234 AKRON
OH','8082267280',30,'F',5),('D1002004','ANKITA','PATIL','7720 MCCALLUM BLVD
APT 1082 DALLAS
TX','9080367266',23,'F',6),('X9324666','TEJASHREE','PANDIT','9082 ESTAES OF
RICHARDSON RICHARDSON
TX','9004360125',28,'F',NULL),('B8765430','LAKSHMI','SHARMA','1110 FIR HILLS
APT 903 AKRON OH','7666190505',30,'F',3),('J9801235','AKHILESH','JOSHI','345
CHATHAM COURTS APT 678 MUMBAI
INDIA','9080369290',29,'M',8),('A1122334','MANAN','LAKHANI','5589 CHTHAM
REFLECTIONS APT 349 HOUSTON
TX','9004335126',25,'F',1),('Q1243567','KARAN','MOTANI','4444 FRANKFORD
VILLA APT 77 GUILDERLAND
NY','9727626643',22,'M',NULL),('S1243269','ROM','SOLANKI','7720 MCCALLUM
BLVD APT 2087 DALLAS
TX','9004568903',60,'M',NULL),('E3277889','John','GATES','1234 BAKER APTS
APT 59 HESSE
GERMANY','9724569986',10,'M',7),('K3212322','SARA','GOMES','6785
SPLITSVILLA APT 34 MIAMI
FL','9024569226',15,'F',9),('P3452390','ALIA','BHAT','548 MARKET PLACE SAN
Francisco CA','9734567800',10,'F',NULL),('W7543336','JOHN','SMITH','6666 ROCK
HILL APT 2902 TAMPA FL','4624569986',55,'M',2),('R8990566','RIA','GUPTA','3355
PALENCIA, APT 2065 MUMBAI
INDIA','4724512343',10,'M',NULL),('M1234568','Indhu','Rebhca','98/b north street
chennai','8956231478',20,'F',9),('M5368924','MEGA','SREE','10/89B SOUTH STREET
NGL','9623452180',17,'F',11),('R1245561','RITHIKA','VJ','202/B NORTH STREET
VADAKKANKULAM','8956231420',17,'F',NULL),('S1562354','SUBA','SHREE',56/A
SOUTH STREET CHENBAGARAMAPUTHOOR','8796452314',17,'F',NULL")
x.commit()
except:
pass
else:
pass
def cust_login():
if x.is_connected():
cur=x.cursor()
def passenger_id():
return random.randint(16,99)
pid=passenger_id()
cur.execute(query%adding)
x.close()
def admin_login():
if x.is_connected():
if username=='aptadmin':#ADMIN USERNAME
if passwd=='afirs_123':#ADMIN PASSWORD
ans='y'
while ans=='y':
print('WELCOME ADMIN')
print('5-->EMPLOYEE DETAILS')
print('6-->TICKET DETAILS')
print('7-->CANCELLED TICKETS')
if ch==1:
cur=x.cursor()
data=cur.fetchall()
h=['AirportName','state','Country','CityName','A_code']
print(tabulate(data,headers=h,tablefmt='grid'))
elif ch==2:
cur=x.cursor()
data=cur.fetchall()
print(tabulate(data,headers=h,tablefmt='pretty'))
if ans=='y':
cur.execute(query%chh)
data2=cur.fetchall()
header=['Airportid','Airportname']
print(tabulate(data2,headers=header,tablefmt='grid'))
else:
data=cur.fetchall()
header=['Airportid','Airportname']
print(tabulate(data,headers=header,tablefmt='grid'))
elif ch==3:
cur=x.cursor()
query=('select
a.flight_code,a.source,a.destination,a.arrival,a.departure,a.status,a.duration,a.flighttype
,a.layover_time,a.no_of_stops,b.airlineid from flight a,contains b')
cur.execute(query)
data3=cur.fetchall()
header=['flight_code','source','destination','arrival','departure','status','duration','fligh
ttype','layover_time','no_of_stops','airlineid']
print(tabulate(data3,headers=header,tablefmt='grid'))
elif ch==4:
cur=x.cursor()
print('------------Details of a Passenger-----------')
cur=x.cursor()
cur.execute('select
a.pid,b.passportno,b.fname,b.lname,b.address,b.phone,b.age,b.sex from passenger1
a,passenger2 b')
data5=cur.fetchall()
header=['PID','PASSPORTNO','FIRSTNAME','LASTNAME','ADDRESS','PHONE','
AGE','SEX']
print(tabulate(data5,headers=header,tablefmt='grid'))
elif ch==5:
cur=x.cursor()
print('------------Details of an Employee-----------')
cur=x.cursor()
if admin_choice=='y':
cur.execute(query%(id_to_search))
data6=cur.fetchall()
print(tabulate(data6,headers=header,tablefmt='grid'))
else:
data6=cur.fetchall()
header=['SSN',' FNAME', 'LNAME', 'ADDRESS',' PHONE', 'AGE',
'SEX', 'AP_NAME']
print(tabulate(data6,headers=header,tablefmt='grid'))
elif ch==6:
cur=x.cursor()
print('--------------TICKET DETAILS---------------')
data7=cur.fetchall()
print(tabulate(data7,headers=h,tablefmt='grid'))
else:
cur=x.cursor()
print('----------------CANCELLED TICKETS---------------')
data7=cur.fetchall()
header=['PID','TICKET_NUMBER','STATUS','SURCHARGE']
print(tabulate(data7,headers=header,tablefmt='grid'))
else:
else:
print('Enter the correct username')
else:
pass
#FOOD ORDERING
def food_order():
print('AFIRS food')
food_menu = {
1: ('shawarma', 10),
2: ('chapathi', 25),
3: ('frenchfries', 15),
5: ('pasta', 85),
6: ('sandwich', 35),
7: ('cupcake', 25),
8: ('sausage', 30),
28: ('momos',50),
while True:
try:
if ch in food_menu:
total_price = price_per_unit * q
print(f"You have chosen {item}. Total cost for this item: {total_price}")
if add_more.lower() != 'y':
break # Exit the loop if user does not want to add more food
else:
except ValueError:
return total_food_price
def beverages():
beverages_menu = {
1: ('tea', 50),
2: ('coffee', 60),
4: ('pepsi', 90),
5: ('fresh juice',99),
8: ('milkshake', 145),
9: ('smoothie', 120),
10: ('liquor',1550),
while True:
try:
if ch in beverages_menu:
total_price = price_per_unit * q
print(f"You have chosen {item}. Total cost for this item: {total_price}")
add_more = input("Do you want to add more beverages? (y/n): ")
if add_more.lower() != 'y':
break # Exit the loop if user does not want to add more beverages
else:
except ValueError:
return total_beverages_price
def main():
print('-' * 40)
x=ms.connect(host='localhost',user='root',passwd='root',database='airport')
cur=x.cursor()
data2=cur.fetchall()
h=['INO','ITEM NAME','QTY']
print(tabulate(data2,headers=h,tablefmt='grid'))
print('-' * 40)
cur=x.cursor()
data1=cur.fetchall()
h=['INO','ITEM NAME','QTY']
print(tabulate(data1,headers=h,tablefmt='grid'))
def flight_booking():
print('************************************BOOKING---
FLIGHTS******************************************')
print('DISCLAIMER: In our Afirs, only selected airports and airlines are available.')
x=ms.connect(host='localhost',user='root',passwd='root',database='airport')
cur = x.cursor()
dataD = cur.fetchall()
# Display cities
data = cur.fetchall()
cur.execute(query, (city,))
data2 = cur.fetchall()
dateofb = date.today()
cur.execute(query, (a_code2,))
data3 = cur.fetchall()
print('CLASS TYPES:')
print('Economy class')
print('Business class')
print('First class')
if food.lower() == 'y':
run=main()
def generate_passenger_id():
def generate_ticket_no():
def generate_seat_number():
return f"{row_number}{seat_letter}"
pid = generate_passenger_id()
ticketnumber = str(generate_ticket_no())
seatnumber = generate_seat_number()
#cur.execute(query%adding)
price = 0
price += 20000
price += 42000
price += 60000
price += 120000
else:
print('
***************************************************************************
****************************')
print(' *')
print(' *')
print(' *')
print(f'* | {Fname} {Lname} AIRLINE ID: {arid} CLASS: {classty} Food: {food}
Service: {service}')
print(' *')
print(' *')
print(' *')
print(' *')
print(f'* +--------------------------------------------------------------------------------------------
----+')
print(' *')
print(f'********************************************************************
***********************************')
else:
def generate_passenger_id():
def generate_ticket_no():
def generate_seat_number():
return f"{row_number}{seat_letter}"
pid = generate_passenger_id()
ticketnumber = str(generate_ticket_no())
seatnumber = generate_seat_number()
#cur.execute(query%adding)
price = 0
price += 20000
price += 42000
price += 60000
price += 120000
else:
print('Please select a valid class type.')
print('
***************************************************************************
****************************')
print(' *')
print(' *')
print(' *')
print(f'* | {Fname} {Lname} AIRLINE ID: {arid} CLASS: {classty} Food: {food}
Service: {service}')
print(' *')
print(' *')
print('
***************************************************************************
****************************')
print(' *')
def browsing_flights():
cur=x.cursor()
data=cur.fetchall()
h=['AIRLINEID','AL_NAME','THREE_DIGIT_CODE']
print(tabulate(data,headers=h,tablefmt='psql'))
x.commit()
cur=x.cursor()
data1=cur.fetchall()
h=['AP_NAME','STATE','COUNTRY','CNAME','a_code']
print('>>>>>>>AIRPORTS AVAILABLE<<<<<<<<')
print(tabulate(data1,headers=h,tablefmt='psql'))
x.commit()
def cancelling_ticket():
if x.is_connected():
try:
print('*' * 100)
cur = x.cursor()
cur.execute(que, PID)
ticket = cur.fetchall()
if not ticket:
return
cur.execute(que2, (ticketnum,))
price_result = cur.fetchall()
if not price_result:
return
print('*' * 100)
dataf = cur.fetchall()
finally:
pass
#MAIN FUNCTION
def menuset():
while True:
print('='*120)
print('='*120)
print(' +--------------------------------------------------------+')
print(' |
****************************************************** |')
print(' |* * |')
print(' |* * |')
print(' |
****************************************************** |')
print(' +--------------------------------------------------------+')
try:
if choice == 1:
cust_login()
elif choice == 2:
admin_login()
elif choice == 3:
flight_booking()
elif choice == 4:
browsing_flights()
elif choice == 5:
cancelling_ticket()
elif choice == 6:
break
else:
except ValueError:
ans = input('Do you want to go through the MENU again? (y/n): ').lower()
break
menuset()
OUTPUT
#CHOOSING MENU 1
#CHOOSING MENU 2:ADMIN LOGIN
#CHOICE 1
#CHOICE 2
CHOICE2
#AFTER GIVING N INSTEAD OF Y
#CHOICE 3
#CHOICE 4
#CHOICE 5
#If yes
#If no
#CHOICE6
#CHOICE 7
#CHOOSING MENU 3
#if no
#If yes
#If needed, ’y’ can be given for adding more varieties of food
#CHOOSING MENU 4
#Choosing menu 5
#choosing menu 6
REFERENCES
• WWW.GOOGLE.COM
• WWW.PYTHON.ORG
• WWW.YOUTUBE.COM