You are on page 1of 33

SYNOPSIS

Title of the project:-


Airline Booking System

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.

Reason for choosing the topic:


Particularly we intended to make a program that would help small airline booking agency business.
This includes processes that help 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

conn = mysql.connector.connect(host='localhost', username='root',password='97809843', database='flight')


my_cursor = conn.cursor()

print("\n************************WELCOME TO FLIGHT BOOKING


SYSTEM******************************")

acc = input("\nDo you have a Account (Yes/No) :-")


e = []
if acc=='Yes' or acc=='yes' or acc=='Y' or acc=='YES':
email = input("\nEnter your email id:-")
e.append(email)
pas = input("\nEnter your password:-")
otp = int(input("\nEnter a OTP sent on your Phone no:-"))

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

state = input("\nEnter your City:-")


em = input("\nEnter your email id:-")
e.append(em)
passw = input("\nEnter your PASSWORD:-")
print(f"\nOTP SEND TO {pn} AND {em}")
ot = int(input("\nENTER THE OTP NO:-"))

print("\n-------YOUR ACCOUNT IS CREATED SUCCESSFULLY-------")

print("\nHow do you want to search your flight by")


print("1. Flight number")
print("2. Location")

ans = int(input("\nAnswer (1/2):-"))

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

con = input("\nWOULD YOU LIKE TO CONTINUE (Y/N):-")


while True:
if con=='n' or con=='N' or con=='no' or con=='NO':
flight_data()
else:
break

passenger = int(input("\nENTER A NUMBER OF PASSANGERS:-"))

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

ch = input("\nDO YOU WANT TO CONTINUE (Y/N):-")

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

print("\nCHOOSE THE CLASS YOU WANT:-")


print("1.ECONOMY CLASS")
print("2.BUSINESS CLASS (+20% CHARGES)")
print("3.FIRST CLASS (+40% CHARGES)")

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)

query9 = "SELECT DESTINATION FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(num)


my_cursor.execute(query9)
for k in my_cursor:
ds.append(k)

query10 = "SELECT TIME_OF_DEPARTURE FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(num)


my_cursor.execute(query10)
for l in my_cursor:
td.append(l)

query11 = "SELECT TIME_OF_ARRIVAL FROM FLIGHTS WHERE FLIGHT_NO = '{}'".format(num)


my_cursor.execute(query11)
for m in my_cursor:
ta.append(m)

cl = int(input("\nENTER CLASS NO (1/2/3):-"))

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

print("class = economy class")


for n in my_cursor:
payment.append(n)
print(f"\nYOU HAVE TO PAY {n} RUPEES")

elif ans==1 and cl==2:


fl_no()
query13 = "SELECT (CHARGES +CHARGES*0.2)*{} FROM FLIGHTS WHERE flight_no = '{}' ".format
(passenger, num)
my_cursor.execute(query13)
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} ") print("Class
= Business class")
for o in my_cursor:
payment.append(o)
print(f"\nYOU HAVE TO PAY {o} RUPEES")

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

elif ans==2 and cl==1:


fl_nm()
query15 = "SELECT CHARGES*{} FROM FLIGHTS WHERE airlines_name = '{}' and DEPARTURE = '{}' and
DESTINATION = '{}' ".format (passenger, fli[0], deplo[0], arrlo[0])
my_cursor.execute(query15)
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")
for q in my_cursor:
25 | P a g e
Flight Booking System
payment.append(q)
print(f"\nYOU HAVE TO PAY {q} RUPEES")

elif ans==2 and cl==2:


fl_nm()
query16 = "SELECT (CHARGES +CHARGES*0.2)*{} FROM FLIGHTS WHERE airlines_name = '{}' and
DEPARTURE = '{}' and DESTINATION = '{}' ".format (passenger, fli[0], deplo[0], arrlo[0])
my_cursor.execute(query16)

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
= Business class")
for r in my_cursor:
payment.append(r)
print(f"\nYOU HAVE TO PAY {r} RUPEES")

elif ans==2 and cl==3:


fl_nm()
query17 = "SELECT (CHARGES +CHARGES*0.4)*{} FROM FLIGHTS WHERE airlines_name = '{}' and
DEPARTURE = '{}' and DESTINATION = '{}' ".format (passenger, fli[0], deplo[0], arrlo[0])
my_cursor.execute(query17)
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 = first class")
for s in my_cursor:

26 | P a g e
Flight Booking System
payment.append(s)
print(f"\nYOU HAVE TO PAY {s} RUPEES")

pay = input("\nTO PAY PRESS (P):-")

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

pay2 = int(input("\nENTER YOUR PAYMENT METHOD (1/2/3/4/5/6/7):-"))

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

print("\nSEE YOU LATER :)")

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

You might also like