Professional Documents
Culture Documents
Prologue:-
The project, Airline Booking System, is to book flights for a small Airline agency business. This gives
the owner the ability to book flights for the customers.
Objective:-
This project will serve to facilitate the agency to book flights. The program is coded using simple
functions and loops. This project is created using python3 and mysql-connector
1|Page
Flight Booking System
Hardware and Software
requirements:
❖ A laptop/computer with OS
windows 10 or 11
❖ CPU- 64 Bit
❖ Python (3.9 64 bit) or lower
❖ Pandas library
❖ MYSQL
❖ MYSQL connector
Limitations
➢ It has no provision to print hard copies.
➢ It is effective only for small-scale business
owners. ➢ There is no provision to add a new
user.
2|Page
Flight Booking System
SCREENSHOTS
3|Page
Flight Booking System
4|Page
Flight Booking System
5|Page
Flight Booking System
6|Page
Flight Booking System
If u don’t have a account in the program
7|Page
Flight Booking System
8|Page
Flight Booking System
If we don’t want the flight we choose before
9|Page
Flight Booking System
|
10 | P a g e
Flight Booking System
11 | P a g e
Flight Booking System
12 | P a g e
Flight Booking System
13 | P a g e
Flight Booking System
14 | P a g e
Flight Booking System
SOURCE CODE
15 | P a g e
Flight Booking System
import mysql.connector
from csv import DictWriter
from csv import DictReader
import os
print("\n-------LOGIN SUCCESSFUL-------")
else:
nam = input("\nEnter your full name:-")
pn = int(input("\nEnter your phone no:-"))
16 | P a g e
Flight Booking System
city = input("\nEnter your Country:-")
if ans==1:
num = (input("\nENTER FLIGHT NUMBER:-"))
query = "SELECT * FROM FLIGHTS WHERE FLIGHT_NO = '{}' ".format(num)
my_cursor.execute(query)
print("\nYOUR FLIGHT DATA IS-------")
for a in my_cursor:
17 | P a g e
Flight Booking System
print(a)
deplo = []
arrlo = []
fli = []
def flight_data():
departure = input("\nENTER YOUR DEPARTURE LOCATION:-")
arrival = input("\nENTER YOUR ARRIVAL LOCATION:-")
query2 = "SELECT AIRLINES_NAME FROM FLIGHTS WHERE DEPARTURE = '{}' AND DESTINATION =
'{}'".format(departure, arrival)
deplo.append(departure)
arrlo.append(arrival)
my_cursor.execute(query2)
print("\nYOUR REQUIRED FLIGHTS ARE------")
for b in my_cursor:
print(b)
fly = input("\nENTER A FLIGHT NAME YOU WANT:-")
fli.append(fly)
print("\n THE DETAILS OF FLIGHT--\n | Flight_name | Departure | Arrival | Flight_no | Departure_Time |
Arrival_Time | Price |")
query3 = "SELECT * FROM FLIGHTS WHERE AIRLINES_NAME = '{}' AND DEPARTURE = '{}' AND
DESTINATION = '{}' ".format(fly, departure, arrival)
my_cursor.execute(query3)
18 | P a g e
Flight Booking System
for c in my_cursor:
return print(c)
if ans==2:
flight_data()
nam=[]
ag=[]
gen=[]
def pass_data():
name = input("\nENTER A NAME OF A PASSENGER:-")
age = int(input(f"\nENTER THE AGE OF {name}:-")) gender
= input("\nMALE/FEMALE:-")
19 | P a g e
Flight Booking System
nam.append(name)
ag.append(age)
gen.append(gender)
with open('userdata.csv', 'a', newline='') as csvfile:
csvwriter = DictWriter(csvfile, fieldnames=['name', 'age', 'gender'])
csvwriter.writeheader()
csvwriter.writerow({'name':name, 'age':age, 'gender':gender}) return
print("\n-------DATA ENTERED SUCCESSFULLY-------")
for d in range(passenger):
pass_data()
def read_csv():
with open('userdata.csv') as csvreader:
reader = DictReader(csvreader)
for row in reader:
print(row)
os.remove(r'userdata.csv')
return print("------------------------------------")
read_csv()
print("\nCHECK YOUR DETAILS----")
while True:
20 | P a g e
Flight Booking System
if ch=='n' or ch=='N' or ch=='no' or ch=='NO':
for e in range(passenger):
pass_data()
read_csv()
else:
break
flo = []
tdep = []
tarr= []
def fl_nm():
query4 = "SELECT FLIGHT_NO FROM FLIGHTS WHERE airlines_name = '{}' and DEPARTURE = '{}' and
DESTINATION = '{}' ".format (fli[0], deplo[0], arrlo[0])
my_cursor.execute(query4)
for f in my_cursor:
flo.append(f)
21 | P a g e
Flight Booking System
query5 = "SELECT TIME_OF_DEPARTURE FROM FLIGHTS WHERE airlines_name = '{}' and DEPARTURE
= '{}' and DESTINATION = '{}' ".format (fli[0], deplo[0], arrlo[0])
my_cursor.execute(query5)
for g in my_cursor:
tdep.append(g)
query6 = "SELECT TIME_OF_ARRIVAL FROM FLIGHTS WHERE airlines_name = '{}' and DEPARTURE =
'{}' and DESTINATION = '{}' ".format (fli[0], deplo[0], arrlo[0])
my_cursor.execute(query6)
for h in my_cursor:
tarr.append(h)
an = []
de = []
ds = []
td = []
ta = []
def fl_no():
query7 = "SELECT AIRLINES_NAME FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(num)
my_cursor.execute(query7)
for i in my_cursor:
an.append(i)
22 | P a g e
Flight Booking System
query8 = "SELECT DEPARTURE FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(num)
my_cursor.execute(query8)
for j in my_cursor:
de.append(j)
payment = []
23 | P a g e
Flight Booking System
if ans==1 and cl==1:
fl_no()
query12 = "SELECT CHARGES*{} FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(passenger, num)
print(f"\nNames = {nam} \nAge = {ag} \nGender = {gen}")
print(f"Flight name = {an} \nDeparture = {de} \nDestination = {ds}")
print(f"Flight number = {num} \nDeparture time = {td} \nArrival time = {ta} ")
24 | P a g e
Flight Booking System
elif ans==1 and cl==3:
fl_no()
query14 = "SELECT (CHARGES +CHARGES*0.4)*{} FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format
(passenger, num)
my_cursor.execute(query14)
print(f"\nNames = {nam} \nAge = {ag} \nGender = {gen}")
print(f"Flight name = {an} \nDeparture = {de} \nDestination = {de}")
print(f"Flight number = {num} \nDeparture time = {td} \nArrival time = {ta} ") print("Class
= First class")
for p in my_cursor:
payment.append(p)
print(f"\nYOU HAVE TO PAY {p} RUPEES")
26 | P a g e
Flight Booking System
payment.append(s)
print(f"\nYOU HAVE TO PAY {s} RUPEES")
if pay=='p' or pay=='P':
print("\nHOW YOU WANT TO PAY ?")
print("1.GOOGLE PAY")
print("2.AMAZON PAY")
print("3.PAYPAL")
print("4.APPLE PAY")
print("5.CREDIT CARD")
print("6.DEBIT CARD")
print("7.BANK TRANSFER")
if pay2==1:
print("\n-------------------GOOGLE PAY---------------------------")
print(F"PAY {payment[0]} RUPEES")
pay3 = input("\nTO CONTINUE PAYMENT PRESS (P):-")
ott = int(input("\nENTER A OTP SENT TO YOUR PHONE NO AND EMAIL:-"))
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("\n**********THANK YOU***********")
27 | P a g e
Flight Booking System
if pay2==2:
print("\n-------------------AMAZON PAY---------------------------")
print(F"PAY {payment[0]} RUPEES")
pay3 = input("\nTO CONTINUE PAYMENT PRESS (P):-")
ott = int(input("\nENTER A OTP SENT TO YOUR PHONE NO AND EMAIL:-"))
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("\n**********THANK YOU***********")
if pay2==3:
print("\n-------------------PAYPAL---------------------------")
print(F"PAY {payment[0]} RUPEES")
pay3 = input("\nTO CONTINUE PAYMENT PRESS (P):-")
ott = int(input("\nENTER A OTP SENT TO YOUR PHONE NO AND EMAIL:-"))
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("**********THANK YOU***********")
if pay2==4:
print("\n-------------------APPLE PAY---------------------------")
print(F"PAY {payment[0]} RUPEES")
pay3 = input("\nTO CONTINUE PAYMENT PRESS (P):-")
ott = int(input("\nENTER A OTP SENT TO YOUR PHONE NO AND EMAIL:-"))
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("**********THANK YOU***********")
28 | P a g e
Flight Booking System
if pay2==5:
print("\n-------------------CARD payment---------------------------")
print(F"PAY {payment[0]} RUPEES")
c_no = int(input("\nENTER YOUR CARD NO:-"))
cvv = int(input("\nENTER YOUR CVV:-"))
ott2 = int(input("\nENTER A OTP SEND TO YOUR NUMBER:-"))
print("\n YOURTRANSACTION SUCCESSFUL------------")
print("**********THANK YOU***********")
if pay2==6:
print("\n-------------------CARD payment---------------------------")
print(F"PAY {payment[0]} RUPEES")
c_no = int(input("\nENTER YOUR CARD NO:-"))
cvv = int(input("\nENTER YOUR CVV:-"))
ott2 = int(input("\nENTER A OTP SEND TO YOUR NUMBER:-"))
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("**********THANK YOU***********")
if pay2==7:
print("\n-------------------Bank Transfer---------------------------")
print(F"PAY {payment[0]} RUPEES")
c_no = int(input("\nENTER YOUR ACCOUNT NO:-"))
our_acc=print("TRANSFER ACCOUNT :- 0990 98780 58742")
print("\n YOUR TRANSACTION SUCCESSFUL------------")
print("**********THANK YOU***********")
29 | P a g e
Flight Booking System
print("\n--------THANKS FOR USING ---------")
print(" ---COPY---")
print(f"\nNames = {nam} \nAge = {ag} \nGender = {gen}") print(f"Flight name = {fli} \nDeparture =
{deplo} \nDestination = {arrlo}") print(f"Flight number = {flo} \nDeparture time= {tdep} \nArrival
time = {tarr} ") print("Class = Economy class")
print(f"\nYOUR TICKETS ARE ALSO SEND TO YOUR EMAIL {e[0]} ")
import numpy as np
import matplotlib.pyplot as plt
val=[6872,6804,68]
X=np.arange(3)
plt.title("COVID-19 CASES
2023")
plt.bar(X,val, color = 'b', width =
0.50)
plt.xticks(X,['Total cases','Total
Recoveries','Total Deaths'])
plt.xlabel('Stats')
plt.ylabel('No.of patients')
plt.show()
30 | P a g e
Flight Booking System
conn.close()
31 | P a g e
Flight Booking System
CONCLUSION
To provide a computer based for booking a flight. To reduce the time, energy, and resources that was being
consumed when performing a booking for the customer. To generate a ticket in appropriate format with customer
details. To provide a convenient solution for travel agencies to record flights in the log. It also allows the user to
check details of flights booked by a customer such as number of passengers, and arrival, departure timings etc.
32 | P a g e
Flight Booking System
BIBLIOGRAPHY
➢ www.google.com
➢ www.youtube.com
33 | P a g e
Flight Booking System