0% found this document useful (0 votes)
33 views71 pages

Airport Management-Rithika Python Project

Uploaded by

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

Airport Management-Rithika Python Project

Uploaded by

rithika170720
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 71

S.A.V.

BALAKRISHNA SCHOOL
Vadakkankulam, Tirunelveli District, Tamil Nadu 627116
CBSE/AFFILIATION/1930738

SESSION: 2024-2025

A PROJECT REPORT ON
AIRPORT MANAGEMENT

SUBMITTED TO SUBMITTED BY:


MR. BALA BENJAMINE V.J.RITHIKA
P.G.T.(COMP. SC) M.S.MEGA SREE
M.SUBA SHREE
REG.NO. :
CERTIFICATE

This is to certify that V.J.RITHIKA,M.S.MEGA


SREE,M.SUBA SHREE of class XII of SAV Balakrishna
School as a team have done their project on Airport
Management under my supervision. They have taken interest
and has shown at most sincerity in completion of this project.

I certify this Project up to my expectation & as per guidelines


issued by CBSE, NEW DELHI.

Internal Examiner External Examiner

Principal
ACKNOWLEDGMENT

It is with pleasure that we acknowledge sincere gratitude to our


teacher, Mr.B.BalaBenjamine who taught and undertook the
responsibility of teaching the subject computer science. We
have been greatly benefited from his classes.
We are especially indebted to our Principal
Mr.B.BalaBenjamine who has always been a source of
encouragement and support and without whose inspiration this
project would not have been a successful we would like to place
on record heartfelt thanks to him.
Finally, we would like to express our sincere appreciation for
all the other students for their friendship & the fine times that
we all shared together.
INTRODUCTION

An Airport Management System (AMS) is a comprehensive


software solution used to manage various operations of an airport.
These operations could include flight scheduling, passenger check-in,
baggage handling, security checks, flight tracking, and resource
management (such as gates, aircraft, and staff). It is crucial for
streamlining the day-to-day activities at an airport to ensure smooth
operations and improve customer experience.

In the context of Python and MySQL, an airport management system


can be developed using Python as the frontend programming language
and MySQL as the database management system.
MODULES/PACKAGES USED
• mysql.connector – To connect with mysql with python.
• tabulate–To display the data in a table in tabular form.
• sys–To display standard input,output and error.
• time–To get current time.
• datetime–To get current date and time.
USER DEFINED MODULES USED
• MainProgram–To execute the main program.
• connector–To create some database and tables in sql via python.
USER DEFINED FUNCTIONS USED
• cust_login()-This function is used for logging in customer details.
• admin_login()-This function is for admin’s view and analysis.
• flight_booking()-This function is used for booking flights and getting
boarding passes.
• browsing_flights()-This function is used for browsing available airlines and
airports.
• cancelling_flights()-This function is used to cancel already booked flights
and get surcharge for it.
• food_order()-This function is to order food.
• beverages()-This function is to order beverages.
• main()-This function is to execute food_order() and beverages().
• passenger_id()-This function is to generate random passengerid.
• generate_ticket_no()-This function is to generate ticket number.
• generate_seat_number()-This function is to generate seat number.
• menuset()-This functions is to handle all other functions.
SOURCE CODE
import mysql.connector as ms

from tabulate import tabulate

from datetime import date

import random

x=ms.connect(host='localhost',user='root',passwd='root',database='airport')

if x.is_connected():

try:

cur=x.cursor()

cur.execute('create database AIRPORT')

print('database created')

except:

pass

#table creation

try:

cur.execute('create table CITY(CNAME VARCHAR(15) NOT NULL,STATE


VARCHAR(15), COUNTRY VARCHAR(30),PRIMARY KEY(CNAME))')

print('table created')

cur.execute('create table AIRPORT_DETAILS(AP_NAME VARCHAR(100) NOT


NULL, STATE VARCHAR(15), COUNTRY VARCHAR(30),CNAME VARCHAR(15),
A_CODE VARCHAR(5),PRIMARY KEY(AP_NAME),FOREIGN KEY(CNAME)
REFERENCES CITY(CNAME)ON DELETE CASCADE)')

print('table created')

cur.execute('create table AIRLINE(AIRLINEID VARCHAR(3) NOT


NULL,AL_NAME VARCHAR(50),THREE_DIGIT_CODE VARCHAR(3),PRIMARY
KEY(AIRLINEID))')

print('table created')

cur.execute('create table FLIGHT(FLIGHT_CODE VARCHAR(10) NOT


NULL,SOURCE VARCHAR(3),DESTINATION VARCHAR(3),ARRIVAL
VARCHAR(10),DEPARTURE VARCHAR(10),STATUS VARCHAR(10),DURATION
VARCHAR(30),FLIGHTTYPE VARCHAR(10),LAYOVER_TIME
VARCHAR(30),NO_OF_STOPS INT,AIRLINEID VARCHAR(3),PRIMARY
KEY(FLIGHT_CODE),FOREIGN KEY(AIRLINEID) REFERENCES
AIRLINE(AIRLINEID) ON DELETE CASCADE)')

print('table created')

cur.execute('create table PASSENGER1(PID INT NOT NULL,PASSPORTNO


VARCHAR(10) NOT NULL,PRIMARY KEY(PID, PASSPORTNO))')

print('table created')

cur.execute('create table PASSENGER2(PASSPORTNO VARCHAR(10) NOT


NULL,FNAME VARCHAR(20),LNAME VARCHAR(20),ADDRESS
VARCHAR(100),PHONE VARCHAR(20),AGE INT,SEX VARCHAR(1),PID
INT,PRIMARY KEY(PASSPORTNO))')

print('table created')

cur.execute('create table CONTAINS(AIRLINEID VARCHAR(3) NOT


NULL,AP_NAME VARCHAR(100) NOT NULL,A_CODE VARCHAR(5),PRIMARY
KEY(AIRLINEID,AP_NAME),FOREIGN KEY(AIRLINEID) REFERENCES
AIRLINE(AIRLINEID) ON DELETE CASCADE,FOREIGN KEY(AP_NAME)
REFERENCES AIRPORT_DETAILS(AP_NAME) ON DELETE CASCADE)')
print('table created')

cur.execute('create table PASSENGER3(PID INT NOT NULL,FLIGHT_CODE


VARCHAR(10),PRIMARY KEY(PID),FOREIGN KEY(FLIGHT_CODE)
REFERENCES FLIGHT(FLIGHT_CODE) ON DELETE CASCADE)')

print('table created')

cur.execute('create table EMPLOYEE1(SSN INT NOT NULL,FNAME


VARCHAR(20),LNAME VARCHAR(20),ADDRESS VARCHAR(100),PHONE
VARCHAR(20),AGE INT,SEX VARCHAR(1),AP_NAME
VARCHAR(100),PRIMARY KEY(SSN),FOREIGN KEY(AP_NAME) REFERENCES
AIRPORT_DETAILS(AP_NAME) ON DELETE CASCADE)')

print('table created')

cur.execute('create table EMPLOYEE2(JOBTYPE VARCHAR(30) NOT


NULL,SALARY INT,PRIMARY KEY(JOBTYPE))')

print('table created')

cur.execute('create table SERVES(SSN INT NOT NULL,PID INT NOT


NULL,PASSPORTNO VARCHAR(10) NOT NULL,PRIMARY KEY(SSN, PID,
PASSPORTNO),FOREIGN KEY(SSN) REFERENCES EMPLOYEE1(SSN) ON
DELETE CASCADE,FOREIGN KEY(PID, PASSPORTNO) REFERENCES
PASSENGER1(PID, PASSPORTNO) ON DELETE CASCADE)')

print('table created')

cur.execute('create table TICKET1(TICKET_NUMBER CHAR(20) NOT


NULL,SOURCE VARCHAR(3),DESTINATION
VARCHAR(3),DATE_OF_BOOKING DATE,DATE_OF_TRAVEL DATE,SEATNO
VARCHAR(5),CLASS VARCHAR(50),PID INT,PASSPORTNO
VARCHAR(10),STATUS VARCHAR(20),FOREIGN KEY(PID, PASSPORTNO)
REFERENCES PASSENGER1(PID, PASSPORTNO) ON DELETE CASCADE)')

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')

cur.execute('create table BEVERAGES(BNO INT,BEVERAGESNAME


VARCHAR(3),PRICE FLOAT))')

print('table created')

cur.execute('create table FOOD(NO INT,FOODITEM


VARCHAR(10),QUANTITY FLOAT))')

print('table created')

cur.execute('create table CANCELLING_FLIGHTS(PID INT NOT


NULL,TICKET_NUMBER CHAR(20),STATUS VARCHAR(20),SURCHARGE
INT,FOREIGN KEY(PID) REFERENCES TICKET2(PID),FOREIGN
KEY(TICKET_NUMBER) REFERENCES TICKET2(TICKET_NUMBER)')

print('table created')

x.commit()

except:

pass

#inserting the values

try:

cur.execute("insert into city(CNAME, STATE, COUNTRY)


VALUES('Louisville','Kentucky','United
States'),('Chandigarh','Chandigarh','India'),('Fort Worth','Texas','United
States'),('Delhi','Delhi','India'),('Mumbai','Maharashtra','India'),('San Francisco',
'California', 'United States'),('Frankfurt','Hesse','Germany'),('Houston','Texas','United
States'),('New York City','New York','United States'),('Tampa', 'Florida', 'United
States'),('Amristar','Delhi','India'),('Canberra','New South
Wales','Australia'),('Bangkok','Samut Prakan','Thailand'),('Chengdu','West
China','China'),('Chennai','Tamil Nadu','India'),('Dubai','Abu Dhabi','United Arab
Emirates'),('Guwahati','Delhi','India'),('Kolkata','Delhi','India'),('Kuala
Lumpur','Selangor','Malaysia'),('Maldives','Hulhule Island','Sri
Lanka'),('Mississauga','Ontario','Ottawa'),('Ota City','Tokyo','Japan'),('Seoul','South
Korea',South Korea'),('Zurich','Kloten','Europe')")

print('values inserted successfully')

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')")

print('values inserted successfully')

cur.execute("insert into AIRLINE(AIRLINEID, AL_NAME,


THREE_DIGIT_CODE) VALUES('AA','American Airlines','001'),('AI','Air India
Limited','098'),('LH','Lufthansa', '220'),('BA','British Airways','125'),('QR','Qatar
Airways','157'),('9W','Jet Airways','589'),('EK','Emirates','176'),('EY','Ethiad
Airways','607')")

print('values inserted successfully')

cur.execute("insert into CONTAINS (AIRLINEID, AP_NAME,A_CODE)


VALUES('AA','Louisville International Airport','LIA'),('AA','Tokyo International
Airport','TIA'),('AA','Velana International Airport','VIA'),('AA','Zurich International
Airport','ZIA'),('AA','John F. Kennedy International Airport','JKI'),('AA','George
Bush Intercontinental Airport','GBI'),('AA','San Francisco International
Airport','SFI'),('AA','Tampa International Airport','TMP'),('AA','Chennai
International Airport','CIA'),('AA','Dubai International
Airport','DIA'),('AA','Frankfurt International Airport','FFA'),('AA','Guru Ram Dass
Je International Airport','GRD'),('AA','Incheon International
Airport','IIA'),('AI','Chandigarh International Airport','CGI'),('AI','Dallas/Fort Worth
International Airport','DFW'),('AI','Indira Gandhi International
Airport','IGI'),('AI','Chhatrapati Shivaji International Airport','CSI'),('AI','George
Bush Intercontinental Airport','GBI'),('AI','San Francisco International
Airport','SFI'),('AI','John F.Kennedy Intenational Airport','JKI'),('AI','Chennai
International Airport','CIA'),('AI','Dubai International Airport','DIA'),('AI','Louisville
International Airport','LIA'),('AI','Suvarnabhumi International
Airport','SIA'),('AI','Tampa International Airport','TMP'),('AI','Tokyo International
Airport','TIA'),('AI','Velana Internatinal Airport','VIA'),('AI','Zurich International
Airport','ZIA'),('AI','Guru Ram Dass Je International
Airport','GRD'),('LH','Chhatrapati Shivaji International
Airport','CSI'),('LH','Frankfurt Airport','FFA'),('LH','John F. Kennedy International
Airport','JKI'),('LH','San Francisco International Airport','SFI'),('LH','Dallas/Fort
Worth International Airport','DFW'),('LH','Chandigarh International
Airport','CGA'),('LH','Chennai International Airport','CIA'),('LH','Dubai
International Airport','DIA'),('LH','George Bush Intercontinental
Airport','GBI'),('LH','Guru Ram Dass Je International Airport','GRD'),('LH','Incheon
International Airport','IIA'),('LH','Indira GandhiInternational
Airport','IGI'),('LH','Louisville International Airport','LIA'),('LH','Suvarnabhumi
International Airport','SIA'),('LH','Tampa International Airport','TMP'),('LH','Tokyo
International Airport','TIA'),('LH','Velana International Airport','VIA'),('LH','Zurich
International Airport','ZIA'),('BA','John F. Kennedy International
Airport','JKI'),('BA','Chhatrapati Shivaji International
Airport','CSI'),('BA','Chandigarh International Airport','CGI'),('BA','Frankfurt
Airport','FFA'),('BA','San Francisco International Airport','SFI'),('BA','Suvarnabhumi
International Airport','SIA'),('BA','Louisville International
Airport','LIA'),('BA','George Bush Intercontinental','GBI'),('BA','Dallas/Forth Worth
International Airport','DFW'),('BA','Tampa International
Airport','TMP'),('BA','Tokyo International Airport','TIA'),('BA','Velana International
Airport','VIA'),('BA','Zurich International Airport','ZIA'),('BA','Dubai International
Airport','DIA'),('BA','Guru Ram Dass Je International Airport','GRD'),('BA','Incheon
International Airport','IIA'),('QR','Chhatrapati Shivaji International
Airport','CSI'),('QR','Dallas/Fort Worth International Airport','DFW'),('QR','John F.
Kennedy International Airport','JKI'),('QR','Tampa International
Airport','TMP'),('QR','Louisville International Airport','LIA'),('9W','Chandigarh
International Airport','CGI'),('9W','Chennai International
Airport','CIA'),('9W','Dallas/Fort Worth International Airport','DFW'),('9W','Guru
Ram Dass Je International Airport','GRD'),('9W','Incheon International
Airport','IIA'),('9W','Indira Gandhi International Airport','IAI'),('9W','Louisville
International Airport','LIA'),('9W','San Francisco International
Airport','SFI'),('9W','Suvarnabhumi International Airport','SIA'),('9W','Tampa
International Airport','TMP'),('9W','Tokyo International Airport','TIA'),('9W','Velana
International Airport','VIA'),('9W','Zurich International Airport','ZIA'),('9W','Dubai
International Airport','DIA'),('9W','Frankfurt International
Airport','FFA'),('9W','George Bush Intercontinental Airport','GBI'),('AA','Chandigarh
International Airport','CGI'),('AA','Indira Gandhi International
Airport','IGI'),('AA','Dallas/Fort Worth International
Airport','DFW'),('AA','Suvarnabhumi International Airport','SIA'),('9W','John F.
Kennedy International Airport','JKI'),('EK','Chandigarh International
Airport','CGI'),('EK','Chennai International Airport','CIA'),('EK','Chhatrapati
Shivaji International Airport','CSI'),('EK','Dallas/Fort Worth International
Airport','DFW'),('EK','Dubai International Airport','DIA'),('EK','George Bush
Intercontinental Airport','GBI'),('EK','Guru Ram Dass Je International
Airport','GRD'),('EK','Incheon International Airport','IIA'),('EK','Indira
GandhiInternational Airport','IGI'),('EK','John F. Kennedy International
Airport',JKI'),('EK','Louisville International Airport','LIA'),('EK','San Francisco
International Airport','SFI'),('EK','Suvarnabhumi International
Airport','SIA'),('EK','Tampa International Airport','TMP'),('EK','Tokyo International
Airport','TIA'),('EK','Velana International Airport','VIA'),('EK','Zurich International
Airport','ZIA'),('EK','Frankfurt Airport','FFA'),('QR','Chandigarh International
Airport','CGI'),('QR','Chennai International Airport','CIA'),('QR','Chhatrapati
Shivaji International Airport','CSI'),('QR','Dallas/Fort Worth International
Airport','DFW'),('QR','Dubai International Airport','DIA'),('QR','Frankfurt
Airport','FFA'),('QR','Guru Ram Dass Je International Airport','GRD'),('QR','Incheon
International Airport','IIA'),('QR','Indira GandhiInternational
Airport','IGI'),('QR',John F. kennedy International Airport','JKI'),('QR','Louisville
International Airport','LIA' ),('QR','San Francisco International
Airport','SFI'),('QR','Suvarnabhumi International Airport','SIA'),('QR','Tampa
International Airport','TMP'),('QR','Tokyo International Airport','TIA'),('QR','Velana
International Airport','VIA'),('QR','Zurich International Airport','ZIA')")

print('values inserted successfully')

cur.execute("insert into FLIGHT(FLIGHT_CODE, SOURCE, DESTINATION,


ARRIVAL, DEPARTURE, STATUS, DURATION, FLIGHTTYPE,
LAYOVER_TIME, NO_OF_STOPS,
AIRLINEID)VALUES('AI2014','BOM','DFW','02:10','03:15','On-
time','24hr','Connecting',3,1,'AI'),('QR2305','BOM','DFW','13:00','13:55','Delayed','21
hr','Non-stop',0,0,'QR'),('EY1234','JFK','TPA','19:20','20:05','On-
time','16hrs','Connecting',5,2,'EY'),('LH9876','JFK','BOM','05:50','06:35','On-
time','18hrs','Non-stop',0,0,'LH'),('BA1689','FRA','DEL','10:20','10:55','On-
time','14hrs','Non-stop',0,0,'BA'),('AA4367','SFO','FRA','18:10','18:55','On-
time','21hrs','Non-
stop',0,0,'AA'),('QR1902','IXC','IAH','22:00','22:50','Delayed','28hrs','Non-
stop',5,1,'QR'),('BA3056','BOM','DFW','02:15','02:55','On-
time','29hrs','Connecting',3,1,'BA'),('EK3456','BOM','SFO','18:50','19:40','On-
time','30hrs','Non-stop',0,0,'EK'),('9W2334','IAH','DEL','23:00','13:45','On-
time','23hrs','Direct',0,0,'9W')")

print('values inserted successfully')

cur.execute("insert into PASSENGER1(PID, PASSPORTNO)


VALUES(1,'A1234568'),(2,'B9876541'),(3,'C2345698'),(4,'D1002004'),(5,'X9324666'),(6,'
B8765430'),(7,'J9801235'),(8,'A1122334'),(9,'Q1243567'),(10,'S1243269'),(11,'E3277889'
),(12,'K3212322'),(13,'P3452390'),(14,'W7543336'),(15,'R8990566')")

print('values inserted successfully')

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")

print('values inserted successfully')

cur.execute("insert into PASSENGER3(PID, FLIGHT_CODE)


VALUES(1,'AI2014'),(2,'LH9876'),(3,'9W2334'),(4,'QR1902'),(5,'EY1234'),(6,'BA3056')
,(7,'9W2334'),(8,'AA4367'),(9,'QR1902'),(10,'EK3456'),(11,'BA1689'),(12,'QR1902'),(13,
'AI2014'),(14,'BA1689'),(15,'QR2305')")

print('values inserted successfully')

cur.execute("insert into employee1(SSN, FNAME, LNAME, ADDRESS, PHONE,


AGE, SEX, AP_NAME)VALUES(123456789,'LINDA','GOODMAN','731 Fondren
Houston TX','4356789345', 35, 'F','Louisville International
Airport'),(333445555,'JOHNY','PAUL','638 Voss Houston TX','9834561995', 40,
'M','Louisville International Airport'),(999887777,'JAMES','BOND','3321 Castle
Spring TX','9834666995', 50, 'M','Louisville International
Airport'),(987654321,'SHERLOCK','HOLMES','123 TOP HILL SAN Francisco
CA','8089654321', 47, 'M','San Francisco International
Airport'),(666884444,'SHELDON','COOPER','345 CHERRY PARK HESSE
GERMANY','1254678903', 55, 'M','Frankfurt
Airport'),(453453453,'RAJ','SHARMA','345 FLOYDS MUMBAI INDIA','4326789031',
35, 'M','Chhatrapati Shivaji International Airport'),(987987987,'NIKITA','PAUL','110
SYNERGY PARK DALLAS TX','5678904325', 33, 'F','Dallas/Fort Worth International
Airport'),(888665555,'SHUBHAM','GUPTA','567 CHANDANI CHOWK DELHI
INDIA','8566778890', 39, 'M','Indira GandhiInternational
Airport'),(125478909,'PRATIK','GOMES','334 VITRUVIAN PARK ALBANY
NY','4444678903', 56, 'M','John F. Kennedy International
Airport'),(324567897,'ADIT','DESAI','987 SOMNATH CHANDIGARH
INDIA','2244658909', 36, 'M','Chandigarh International Airport')")

print('values inserted successfully')

cur.execute("insert into employee2(JOBTYPE,


SALARY)VALUES('ADMINISTRATIVE
SUPPORT',50000),('ENGINEER',70000),('TRAFFIC MONITOR',80000),('AIRPORT
AUTHORITY',90000)")

print('values inserted successfully')

cur.execute("insert into serves(SSN, PID, PASSPORTNO)


VALUES(123456789,1,'A1234568'),(123456789,15,'R8990566'),(123456789,9,'Q1243567
'),(888665555,4,'D1002004'),(888665555,13,'P3452390'),(333445555,10,'S1243269'),(3334
45555,12,'K3212322'),(123456789,7,'J9801235'),(888665555,7,'J9801235')")

print('values inserted successfully')

cur.execute("insert into ticket1(TICKET_NUMBER, SOURCE, DESTINATION,


DATE_OF_BOOKING, DATE_OF_TRAVEL, SEATNO, CLASS, PID,
PASSPORTNO,STATUS)VALUES(011234111122,'BOM','DFW','2016-05-11','2016-12-
15','32A','ECONOMY',1,'A1234568','TO-
BOARD'),(0984567222299,'JFK','BOM','2016-06-11','2016-12-10','2016-12-
20','45D','ECONOMY',2,'B9876541','TO-
BOARD'),(1768901333273,'IAH','DEL','2016-08-21','2016-12-
25','1A','BUSINESS',3,'C2345698','TO-BOARD'),(5890987441464,'IXC','IAH','2016-
08-10','2017-01-12','20C','FIRST-CLASS',4,'D1002004','TO-
BOARD'),(1577654664266,'JFK','TPA','2016-06-13','2016-12-
10','54E','ECONOMY',5,'X9324666','TO-
BOARD'),(2206543545545,'BOM','DFW','2016-12-11','2017-02-
12','43B','ECONOMY',6,'B8765430','TO-
BOARD'),(7064321779737,'IAH','DEL','2016-11-15','2016-12-25','27B','FIRST-
CLASS',7,'J9801235','TO-BOARD'),(1571357215116,'SFO','FRA','2016-08-15','2016-
12-18','34E','ECONOMY',8,'A1122334','TO-
BOARD'),(1570864987655,'IXC','IAH','2016-11-12','2016-12-
30','54C','ECONOMY',9,'Q1243567','TO-
BOARD')(1579283997799,'BOM','SFO','2016-01-22','2016-12-
15','38A','ECONOMY',10,'S1243269','TO-
BOARD'),(1255701876107,'FRA','DEL','2016-08-19','2016-12-
31','57F','ECONOMY',11,'E3277889','TO-
BOARD'),(1251334499699,'IXC','IAH','2016-11-20','2016-01-
12','45D','ECONOMY',12,'K3212322','TO-
BOARD'),(1258776199490,'BOM','DFW','2016-05-13','2016-12-
15','37C','ECONOMY',13,'P3452390','TO-
BOARD'),(5891155114477,'FRA','DEL','2016-06-26','2016-12-
23','55C','ECONOMY',14,'W7543336','TO-
BOARD'),(5893069766787,'BOM','DFW','2016-08-11','2016-12-
22','33F','ECONOMY',15,'R8990566','TO-BOARD')")

print('values inserted successfully')

cur.execute("insert into ticket2(DATE_OF_BOOKING, SOURCE,


DESTINATION, CLASS, PRICE,TICKET_NUMBER) VALUES('2016-05-
11','BOM','DFW','ECONOMY',95000,'011234111122'),('2016-06-
11','JFK','BOM','ECONOMY',100000','0984567222299'),('2016-08-
21','IAH','DEL','BUSINESS',200000,'1768901333273'),('2016-08-
10','IXC','IAH','FIRST-CLASS',150000,'5890987441464'),('2016-06-
13','JFK','TPA','ECONOMY',98000,'1577654664266'),('2016-11-
06','BOM','DFW','ECONOMY',125000,NULL),('2016-11-15','IAH','DEL','FIRST-
CLASS',195000,'7064321779737'),('2016-10-
15','SFO','FRA','ECONOMY',170000,NULL),('2016-11-
15','IXC','IAH','ECONOMY',140000,'7064321779737'),('2016-01-
22','BOM','SFO','ECONOMY',45000,'1579283997799'),('2016-10-
15','FRA','DEL','ECONOMY',100000,NULL),('2016-11-
20','IXC','IAH','ECONOMY',120000,'1251334499699'),('2016-05-
13','BOM','DFW','ECONOMY',65000,'1258776199490'),('2016-06-
26','FRA','DEL','ECONOMY',80000,'5891155114477'),('2016-08-
11','BOM','DFW','ECONOMY',98000,'5893069766787')")
print('values inserted successfully')

x.commit()

except:

pass

else:

pass

#CREATING CUSTOMER LOGIN PANEL

def cust_login():

if x.is_connected():

cur=x.cursor()

passno=input('enter your passport number:')

Fname=input('enter your first name')

Lname=input('enter your last name')

address=input('enter your residential address')

phone=input('enter your phone number')

age=int(input('enter your age'))

sex=input('enter your gender F or M')

def passenger_id():

return random.randint(16,99)

pid=passenger_id()

query="insert into airport.passenger2


values('%s','%s','%s','%s','%s',%s,'%s',%s)"
adding=(passno,Fname,Lname,address,phone,age,sex,pid)

cur.execute(query%adding)

print('Registration done successfully.')

x.close()

#CREATING ADMIN LOGIN PANEL

def admin_login():

if x.is_connected():

username=input('enter the username:')

if username=='aptadmin':#ADMIN USERNAME

passwd=input('enter the passwd:')

if passwd=='afirs_123':#ADMIN PASSWORD

ans='y'

while ans=='y':

print('WELCOME ADMIN')

print('Choose menu to go through:')

print('1-->Cities and Airports')

print('2-->Available AIRPORTS for particular AIRLINES')

print('3-->Available FLIGHTS for boarding')

print('4-->Details of passengers on board')

print('5-->EMPLOYEE DETAILS')

print('6-->TICKET DETAILS')
print('7-->CANCELLED TICKETS')

ch=int(input('enter your choice'))

if ch==1:

cur=x.cursor()

print('--------------CITIES AND AIRPORTS CURRENTLY ACTIVE------


---------')

cur.execute('select *from airport_details')

data=cur.fetchall()

h=['AirportName','state','Country','CityName','A_code']

print(tabulate(data,headers=h,tablefmt='grid'))

elif ch==2:

cur=x.cursor()

print('---------Available Airlines and their destination routes---------')

cur.execute('select *from Airline')

data=cur.fetchall()

h=['AIRLINEID', 'AL_NAME',' THREE_DIGIT_CODE']

print(tabulate(data,headers=h,tablefmt='pretty'))

ans=input('Do you want to search about airlines particularly?y/n')

if ans=='y':

chh=(input('enter the airlineid to search'))

query=('select *from contains where airlineid="%s"')

cur.execute(query%chh)

data2=cur.fetchall()
header=['Airportid','Airportname']

print(tabulate(data2,headers=header,tablefmt='grid'))

else:

cur.execute('select *from contains')

data=cur.fetchall()

header=['Airportid','Airportname']

print(tabulate(data,headers=header,tablefmt='grid'))

elif ch==3:

cur=x.cursor()

print('---------Available flights on board--------------')

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-----------')

admin_choice=input('Press Y to see the details of particular


employee,Press N to see details of all the employees')

cur=x.cursor()

if admin_choice=='y':

id_to_search=input('enter the phone number to search:')

query='select *from employee1 where phone="%s"'

cur.execute(query%(id_to_search))

data6=cur.fetchall()

header=['SSN',' FNAME', 'LNAME','ADDRESS',' PHONE', 'AGE',


'SEX', 'AP_NAME']

print(tabulate(data6,headers=header,tablefmt='grid'))

else:

cur.execute('select *from employee1')

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---------------')

cur.execute('select TICKET_NUMBER, SOURCE, DESTINATION,


DATE_OF_BOOKING, DATE_OF_TRAVEL from ticket1')

data7=cur.fetchall()

h=['TICKET_NUMBER', 'SOURCE', 'DESTINATION',


'DATE_OF_BOOKING',' DATE_OF_TRAVEL']

print(tabulate(data7,headers=h,tablefmt='grid'))

else:

cur=x.cursor()

print('----------------CANCELLED TICKETS---------------')

cur.execute('select *from cancelling_flights')

data7=cur.fetchall()

header=['PID','TICKET_NUMBER','STATUS','SURCHARGE']

print(tabulate(data7,headers=header,tablefmt='grid'))

ans=input('Do you want to continue?')

else:

print('Enter the correct password')

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),

4: ('cup noodles', 30),

5: ('pasta', 85),

6: ('sandwich', 35),

7: ('cupcake', 25),

8: ('sausage', 30),

9: ('cup noodles premium', 50),

10: ('cup noodles', 60),

11: ('salad', 25),

12: ('desserts', 90),


13: ('butter jam', 80),

14: ('burger', 30),

15: ('donut', 80),

16: ('pizza', 75),

17: ('puffs', 80),

18: ('fries', 50),

19: ('yogurt', 50),

20: ('maggie', 50),

21: ('masala dosa', 50),

22: ('veg pulao', 50),

23: ('chicken pasta', 50),

24: ('chicken biryani', 50),

25: ('vegetable biryani', 50),

26: ('veg paneer kadai', 50),

27: ('smoked turkey', 50),

28: ('momos',50),

29: ('steak baked potato', 55),

30: ('Pav Bhaji',80)

total_food_price = 0 # Initialize total food price

while True:
try:

ch = int(input("Enter the passenger choice (1-30): "))

if ch in food_menu:

item, price_per_unit = food_menu[ch]

q = int(input(f"Enter the quantity for {item}: "))

total_price = price_per_unit * q

total_food_price += total_price # Add to total food price

print(f"You have chosen {item}. Total cost for this item: {total_price}")

add_more = input("Do you want to add more food? (y/n): ")

if add_more.lower() != 'y':

break # Exit the loop if user does not want to add more food

else:

print('Please enter a valid choice from the menu.')

except ValueError:

print("Invalid input! Please enter a valid number.")

return total_food_price

# Function to handle beverage orders

def beverages():

beverages_menu = {
1: ('tea', 50),

2: ('coffee', 60),

3: ('red bull', 85),

4: ('pepsi', 90),

5: ('fresh juice',99),

6: ('coca cola', 99),

7: ('hot chocolate', 150),

8: ('milkshake', 145),

9: ('smoothie', 120),

10: ('liquor',1550),

total_beverages_price = 0 # Initialize total beverages price

while True:

try:

ch = int(input("Enter the beverages choice (1-10): "))

if ch in beverages_menu:

item, price_per_unit = beverages_menu[ch]

q = int(input(f"Enter the quantity for {item}: "))

total_price = price_per_unit * q

total_beverages_price += total_price # Add to total beverages price

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:

print('Please enter a valid choice from the menu.')

except ValueError:

print("Invalid input! Please enter a valid number.")

return total_beverages_price

# Main logic to order food and beverages

def main():

print('-' * 40)

print('YOUR FOOD WILL BE PROVIDED AFTER BOARDING')

from tabulate import tabulate

x=ms.connect(host='localhost',user='root',passwd='root',database='airport')

cur=x.cursor()

cur.execute('select *from food')

data2=cur.fetchall()

h=['INO','ITEM NAME','QTY']
print(tabulate(data2,headers=h,tablefmt='grid'))

total_food_price = food_order() # Get total food price from food_order function

print('-' * 40)

print('YOUR BEVERAGES WILL BE PROVIDED AFTER BOARDING')

cur=x.cursor()

cur.execute('select *from beverages')

data1=cur.fetchall()

h=['INO','ITEM NAME','QTY']

print(tabulate(data1,headers=h,tablefmt='grid'))

total_beverages_price = beverages() # Get total beverages price from beverages


function

total_amount = total_food_price + total_beverages_price

print(f'Total food amount: {total_food_price}')

print(f'Total beverage amount: {total_beverages_price}')

print(f'Total amount: {total_amount}')

#FUNCTION TO HANDLE FLIGHT BOOKING

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')

# Database connection (ensure cur is initialized correctly)

cur = x.cursor()

# Ask for service type: arrival or departure

service = input('Enter the service type: arrival or departure? ')

# Display available airports

cur.execute('SELECT * FROM airport_details')

dataD = cur.fetchall()

h = ['AP_NAME', 'STATE', 'COUNTRY', 'CNAME', 'AIRPORTCODE']

print(tabulate(dataD, headers=h, tablefmt='grid', stralign='centre'))

# Source airport code input

a_code = input('Enter your source airport (departure) code to select: ')

# Display cities

cur.execute('SELECT * FROM city')

data = cur.fetchall()

header = ['CNAME', 'STATE', 'COUNTRY']


print(tabulate(data, headers=header, tablefmt='grid', stralign='centre'))

# Select destination city

print('Select your desired state of your destination')

city = input('Enter the state name: ')

query = 'SELECT * FROM airport_details WHERE state=%s'

cur.execute(query, (city,))

data2 = cur.fetchall()

print(tabulate(data2, headers=h, tablefmt='grid', stralign='centre'))

# Destination airport code input

a_code2 = input('Enter your destination airport (arrival) code to select: ')

# Travel and booking dates

dateoft = input('Enter the travel date as YYYY/MM/DD: ')

dateofb = date.today()

# Select airline for the destination airport

query = 'SELECT * FROM contains WHERE a_code=%s'

cur.execute(query, (a_code2,))

data3 = cur.fetchall()

print(tabulate(data3, headers=['AIRLINEID', 'AIRPORT NAME', 'AIRPORT


CODE'], tablefmt='grid', stralign='centre'))
# Select airline by ID

arid = input('Enter the airline ID: ')

cur.execute('SELECT * FROM airline WHERE airlineid=%s', (arid,))

print('THANK YOU FOR CHOOSING OUR AIRLINE')

# Select class type

print('SELECT THE TYPE OF CLASS YOU WOULD LIKE')

print('CLASS TYPES:')

print('Economy class')

print('Premium economy class')

print('Business class')

print('First class')

classty = input('Enter the class type: ')

# Get passport number and food option

passno = input('Enter your passport number: ')

food = input('WOULD YOU LIKE TO ADD FOOD TO YOUR TICKET? [PRESS


YES TO CONTINUE] ')

if food.lower() == 'y':

run=main()

Fname = input('Enter your first name: ')


Lname = input('Enter your last name: ')

address = input('Enter your residential address: ')

phone = input('Enter your phone number: ')

age = int(input('Enter your age: '))

sex = input('Enter your gender F or M: ')

# Generate random passenger ID, ticket number, and seat number

def generate_passenger_id():

return random.randint(16, 99)

def generate_ticket_no():

return random.randint(1, 9999999999999)

def generate_seat_number():

row_number = random.randint(1, 50)

seat_letter = random.choice(['A', 'B', 'C', 'D', 'E', 'F'])

return f"{row_number}{seat_letter}"

pid = generate_passenger_id()

ticketnumber = str(generate_ticket_no())

seatnumber = generate_seat_number()

# Insert ticket details into the database


query='INSERT INTO ticket1 VALUES ("%s",
"%s","%s","%s","%s","%s","%s",%s,"%s")'

adding=(ticketnumber, a_code, a_code2, dateofb, dateoft, seatnumber, classty, pid,


passno)

#cur.execute(query%adding)

# Set ticket price based on class type

price = 0

if classty.lower() == 'economy class':

price += 20000

elif classty.lower() == 'premium economy class':

price += 42000

elif classty.lower() == 'business class':

price += 60000

elif classty.lower() == 'first class':

price += 120000

else:

print('Please select a valid class type.')

# Insert price details into the database

#query2='INSERT INTO ticket2 VALUES ("%s","%s","%s","%s",%s,"%s")'

#adding2=(dateofb, a_code, a_code2, classty, price, ticketnumber)


print(f"Your ticket has been successfully booked. Ticket number: {ticketnumber},
Seat: {seatnumber}, Price: {price}")

#Display boarding pass

print('
***************************************************************************
****************************')

print(' *')

print(f'* +- {a_code2} --------------------------------------------{dateofb}--------


+=======AFIRS==========+')

print(' *')

print(f'* |========================================= BOARDING


PASS ========================================|')

print(' *')

print(f'* | {Fname} {Lname} AIRLINE ID: {arid} CLASS: {classty} Food: {food}
Service: {service}')

print(' *')

print(f'* | From: {a_code}... TO: {a_code2} ... DATE: {dateoft} AMNT:{price}')

print(' *')

print(f'* | Passport No: {passno} Seat No: {seatnumber} passengerid:{pid}')

print(' *')

print(f'* | BOARDING GATES CLOSE 15 MINUTES PRIOR TO DEPARTURE


- MAKE SURE TO BE ON TIME... HAPPY JOURNEY! |')

print(' *')

print(f'* +--------------------------------------------------------------------------------------------
----+')
print(' *')

print(f'********************************************************************
***********************************')

else:

Fname = input('Enter your first name: ')

Lname = input('Enter your last name: ')

address = input('Enter your residential address: ')

phone = input('Enter your phone number: ')

age = int(input('Enter your age: '))

sex = input('Enter your gender F or M: ')

# Generate random passenger ID, ticket number, and seat number

def generate_passenger_id():

return random.randint(16, 99)

def generate_ticket_no():

return random.randint(1, 9999999999999)

def generate_seat_number():

row_number = random.randint(1, 50)

seat_letter = random.choice(['A', 'B', 'C', 'D', 'E', 'F'])

return f"{row_number}{seat_letter}"
pid = generate_passenger_id()

ticketnumber = str(generate_ticket_no())

seatnumber = generate_seat_number()

# Insert ticket details into the database

query='INSERT INTO ticket1 VALUES ("%s",


"%s","%s","%s","%s","%s","%s",%s,"%s")'

adding=(ticketnumber, a_code, a_code2, dateofb, dateoft, seatnumber, classty, pid,


passno)

#cur.execute(query%adding)

# Set ticket price based on class type

price = 0

if classty.lower() == 'economy class':

price += 20000

elif classty.lower() == 'premium economy class':

price += 42000

elif classty.lower() == 'business class':

price += 60000

elif classty.lower() == 'first class':

price += 120000

else:
print('Please select a valid class type.')

# Insert price details into the database

#query2='INSERT INTO ticket2 VALUES ("%s","%s","%s","%s",%s,"%s")'

#adding2=(dateofb, a_code, a_code2, classty, price, ticketnumber)

print(f"Your ticket has been successfully booked. Ticket number: {ticketnumber},


Seat: {seatnumber}, Price: {price}")

#Display boarding pass

print('
***************************************************************************
****************************')

print(' *')

print(f'* +- {a_code2} --------------------------------------------{dateofb}--------


+=======AFIRS==========+')

print(' *')

print(f'* |========================================= BOARDING


PASS ========================================|')

print(' *')

print(f'* | {Fname} {Lname} AIRLINE ID: {arid} CLASS: {classty} Food: {food}
Service: {service}')

print(' *')

print(f'* | From: {a_code}... TO: {a_code2} ... DATE: {dateoft} AMNT:{price}')

print(' *')

print(f'* | Passport No: {passno} Seat No: {seatnumber} passengerid:{pid}')


print(' *')

print(f'* | BOARDING GATES CLOSE 15 MINUTES PRIOR TO DEPARTURE


- MAKE SURE TO BE ON TIME... HAPPY JOURNEY! |')

print('
***************************************************************************
****************************')

print(' *')

#FUNCTION TO HANDLE BROWING AVAILABLE FIGHTS AND AIRPORTS

def browsing_flights():

cur=x.cursor()

cur.execute("select* from airline")

data=cur.fetchall()

h=['AIRLINEID','AL_NAME','THREE_DIGIT_CODE']

print('>>>>AVAILABLE AIRLINES IN OUR AFIRS<<<<')

print(tabulate(data,headers=h,tablefmt='psql'))

x.commit()

cur=x.cursor()

cur.execute("select* from airport_details")

data1=cur.fetchall()

h=['AP_NAME','STATE','COUNTRY','CNAME','a_code']
print('>>>>>>>AIRPORTS AVAILABLE<<<<<<<<')

print(tabulate(data1,headers=h,tablefmt='psql'))

x.commit()

#FUNTION TO HANDLE CANCELLING OF FLIGHTS

def cancelling_ticket():

if x.is_connected():

"""Cancel a ticket and display the bill with surcharge"""

try:

from datetime import datetime

# Fetch ticket details

print('*' * 100)

cur = x.cursor()

ID =input("Enter your passenger ID: ")

PID = (ID,) # PID should be a tuple

# Fetch the ticket number using the passenger ID

que = 'SELECT TICKET_NUMBER FROM ticket1 WHERE PID = %s'

cur.execute(que, PID)

ticket = cur.fetchall()
if not ticket:

print("No ticket found for this passenger ID.")

return

ticketnum = ticket[0][0] # Extract the ticket number from the tuple

# Fetch the price of the ticket

que2 = 'SELECT price FROM ticket2 WHERE TICKET_NUMBER = %s'

cur.execute(que2, (ticketnum,))

price_result = cur.fetchall()

if not price_result:

print("No price found for this ticket.")

return

price = price_result[0][0] # Extract the price

# Calculate surcharge (assuming a fixed surcharge for simplicity)

surcharge = 50 # Example surcharge

total_price = price + surcharge

# Insert cancellation details into the database

cur.execute('INSERT INTO cancelling_flights (pid, TICKET_NUMBER,


surcharge) VALUES (%s, %s , %s)',
(PID[0], ticketnum, surcharge))

print('TICKET CANCELLED SUCCESSFULLY')

print('*' * 100)

print('THE RECEIPT WITH SURCHARGE ', '|',


datetime.now(), '|')

# Fetch and display the cancellation details

cur.execute('SELECT * FROM cancelling_flights')

dataf = cur.fetchall()

header = ['PID', 'TICKET NUMBER', 'STATUS', 'SURCHARGE']

print(tabulate(dataf, headers=header, tablefmt='grid', stralign='center'))

print('THANK YOU FOR YOUR COOPERATION')

finally:

pass

#MAIN FUNCTION

def menuset():

while True:

print('='*120)

print('- +'*16, "WELCOME TO AFIRS\u2708\uFE0F", '+ -'*16)


print('='*120)

print('- +'*15, '~TRAVEL WITH EASE~🗺⁀જ✈︎', '+ -'*15)

print('='*120)

print('Choose the MENU you want to execute')

print(' +--------------------------------------------------------+')

print(' |
****************************************************** |')

print(' |* * |')

print(' |* 1-->>CUSTOMER_LOGIN<<- * |')

print(' |* 2-->>ADMIN_LOGIN<<-- * |')

print(' |* 3-->>FLIGHTS_BOOKING<<-- * |')

print(' |* 4-->>BROWSING FLIGHTS and AIRPORTS<<--


* |')

print(' |* 5-->>CANCELLING_FLIGHTS<<-- * |')

print(' |* 6-->>EXIT<<-- * |')

print(' |* * |')

print(' |
****************************************************** |')

print(' +--------------------------------------------------------+')

try:

choice = int(input('Enter your choice: '))

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:

print('THANK YOU FOR USING OUR SERVICE!') # Graceful exit message

break

else:

print("Invalid choice, please choose a valid option between 1 and 6.")

except ValueError:

print("Invalid input! Please enter a valid number.")

ans = input('Do you want to go through the MENU again? (y/n): ').lower()

if ans not in ['y', 'yes']:

print('THANK YOU FOR USING OUR SERVICE!')

break

# Call the menu function

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

You might also like