Cs Project Z
Cs Project Z
INDEX
2 Theoretical background 4
3 Program description 9
4 Functions used 11
5 Program 13
6 Output 26
9 Bibliography 35
2
HARDWARE REQUIREMENTS
SOFTWARE REQUIREMENTS
3
THEORETICAL BACKGROUND
WHAT IS PYTHON?
HISTORY OF PYTHON:
The programming language Python was conceived in the
late 1980s, and its implementation was started in
December 1989 by Guido van Rossum at CWI in the
Netherlands as a successor to ABC capable of exception
handling and interfacing with the Amoeba
4
operating system. Van Rossum is Python's principal
author, and his continuing central role in deciding the
direction of Python is reflected in the title given to him
by the Python community, Benevolent Dictator for Life
(BDFL). (However, van Rossum stepped down as leader on
July 12, 2018. Python 2.0 was released on October 16,
2000, with many major new features for memory
management and support for Unicode.
WHAT IS A DATABASE?
5
database, to a distributed database, cloud database,
graph database or NoSQL database.
RELATIONAL DATABASE:
6
example, it may display data in a tables like a
spreadsheet, allowing you to view and even edit
individual values in the table. Some RDMBS programs
allow you to create forms that can streamline entering,
editing, and deleting data. Most well known DBMS
applications fall into the RDBMS category. Examples
include Oracle Database, MySQL, Microsoft SQL Server,
and IBM DB2. Some of these programs support non-
relational databases, but they are primarily used for
relational database management.
WHAT IS SQL?
7
HISTORY OF SQL: SQL was initially developed at IBM by
Donald D. Chamberlin and Raymond F. Boyce after
learning about the relational model from Edgar F. Codd
in the early 1970s. This version, initially called SEQUEL
(Structured English Query Language), was designed to
manipulate and retrieve data stored in IBM's original
quasi-relational database management system, System R,
which a group at IBM San Jose Research Laboratory had
developed during the 1970s. In the late 1970s, Relational
Software, Inc. (now Oracle Corporation) saw the potential
of the concepts described by Codd, Chamberlin, and
Boyce, and developed their own SQL-based RDBMS with
aspirations of selling it to the U.S. Navy, Central
Intelligence Agency, and other U.S. government agencies.
In June 1979, Relational Software, Inc. introduced the
first com VAX computers. By 1986, ANSI and ISO
standard groups officially adopted the standard
"Database Language SQL" language definition. New
versions of the standard were published in 1989, 1992,
1996, 1999, 2003, mercially available implementation of
SQL, Oracle V2 (Version2) for 2006, 2008, 2011 and,
most recently, 2016.
8
PROGRAM DESCRIPTION
9
Objective:
To create database for monitoring Air reservation
tickets
Creating tables
Storing passenger details
Storing flight details
Reserving tickets
Generate an invoice
Accepting ratings
Cancelling reservations
10
FUNCTIONS USED
Create_flight():
This function is used to create a new empty table
flight into which we can enter numerous records of
flight details into 7 various columns.
insert_flight():
Insert function is utilized to insert the records of
flights.(Flightnumber, Flightname, Source, Departure
Time, Destination, Arrival time, Duration)
create_passenger():
This function is used a new empty table passenger
into which we can enter numerous records of
passenger details fed by the user into 9 different
columns
inputpass():
Inputpass function obtains the passenger
details,inserts and stores it in the table passenger. It
calls the function classpre().
class_seat_pre():
This function is called inside inputpass().It is used to
get the preferred class and seat of the passengers.
11
billgenerate():
This function asks the meal choice of passengers
before generating the bill. It calls payment function
inside it and also generates ticket in the form of csv.
payment():
This function directs the user to the payment window
and gives choice between card or netbanking.
cancelticket():
Cancelticket function cancels the reservations of the
passengers whose phone number has been fed,
deletes the record and refunds a part of the amount
paid.
rating():
This function allows the passengers to rate the
services provided
12
PROGRAM CODE
import mysql.connector
con=mysql.connector.connect(host="localhost",user='root',passwor
d="devi",database='comet')
cur=con.cursor()
print("~~~~COMET AIRLINES WELCOMES YOU~~~")
def create_flight():
q1= "create table flight(f_no char(6),f_name varchar(20),Source
varchar(20),Departure_Date_time varchar(30),Destination
varchar(14),Arrival_Date_time varchar(30),Duration varchar(12))"
cur.execute(q1)
print("-----Flight table created-----")
def insert_flight():
q2="insert into flight values('6E5337','Skyburster','Chennai','Fri
8/Mar/24 09:35','Paris','Fri 8/Mar/24 20:10','10hr30min')"
cur.execute(q2)
13
q3="insert into flight values('5A7823','Aurora','Mumbai','Sun
3/Mar/24 15:00','Srinagar','Sun 3/Mar/24 17:40','2hr40min')"
cur.execute(q3)
def create_passenger():
q7="create table passenger(p_name varchar(20),Age int,Gender
char(2),ID char(12) primary key,phone_no char(10),email_id
varchar(30),Nationality varchar(20),Class varchar(20),Seat char(3)
,f_no char(6))"
cur.execute(q7)
14
print('-----Passenger table created-----')
def class_seat_pre():
avail=len(E)+len(B)+len(F)
print("AVAILABILITY OF TICKETS",avail)
print('1.ECONOMY CLASS: RS 7000.00')
print('2.BUSINESS CLASS:RS 15000.00')
print('3.FIRST CLASS: RS 30000.00')
cch=int(input("enter preferred class:"))
while True:
if cch==1:
print(E)
sch=input('Enter preferred seat:')
E.remove(sch)
return 'Economy class',sch
elif cch==2:
print(B)
sch=input('Enter preferred seat:')
B.remove(sch)
return 'Business class',sch
15
elif cch==3:
print(F)
sch=input('Enter preferred seat:')
F.remove(sch)
return 'First class',sch
else:
print('wrong choice')
cch=int(input('enter preferred class:'))
continue
def inputpass():
pname=input("Enter your name: ")
Age=int(input("Enter Age: "))
Gen=input("Enter Gender(M/F) :")
ph=int(input("Enter phone number"))
ID=input('enter Aadhar number:')
email=input("Enter emailid :")
nat=input("Enter nationality :")
print('Sno','f_no','Source','Destination',sep='\t')
print('1.','6E5337','Chennai','Paris',sep='\t')
print('2.','5A7823','Mumbai','Srinagar',sep='\t')
print('3.','1H4678','NewYork','Kolkata',sep='\t')
print('4.','2D2698','Assam','Delhi',sep='\t')
print('5.','3J7077','Delhi','Austin',sep='\t')
16
fch=int(input('Enter your choice:'))
while True:
if fch==1:
f='6E5337'
q="insert into passenger
values('{}',{},'{}','{}','{}','{}','{}',NULL,NULL,'{}')".format(pname
, Age,Gen,ID,ph,email,nat,f)
cur.execute(q)
x,y=class_seat_pre()
q1="update passenger set Class='{}',Seat='{}' where
p_name='{}'".format(x,y,pname)
cur.execute(q1)
con.commit()
break
elif fch==2:
f='5A7823'
q="insert into passenger
values('{}',{},'{}','{}',{},'{}','{}',NULL,NULL,'{}')".format(pname,
Age,Gen,ID,ph,email,nat,f)
cur.execute(q)
x,y=class_seat_pre()
q1="update passenger set Class='{}',Seat='{}' where
p_name='{}'".format(x,y,pname)
cur.execute(q1)
17
con.commit()
break
elif fch==3:
f='1H4678'
q="insert into passenger
values('{}',{},'{}','{}',{},'{}','{}',NULL,NULL,'{}')".format(pname,
Age,Gen,ID,ph,email,nat,f)
cur.execute(q)
x,y=class_seat_pre()
q1="update passenger set Class='{}',Seat='{}' where
p_name='{}'".format(x,y,pname)
cur.execute(q1)
con.commit()
break
elif fch==4:
f='2D2698'
q="insert into passenger
values('{}',{},'{}','{}',{},'{}','{}',NULL,NULL,'{}')".format(pname,
Age,Gen,ID,ph,email,nat,f)
cur.execute(q)
x,y=class_seat_pre()
q1="update passenger set Class='{}',Seat='{}' where
p_name='{}'".format(x,y,pname)
18
cur.execute(q1)
con.commit()
break
elif fch==5:
f='3J7077'
q="insert into passenger
values('{}',{},'{}','{}',{},'{}','{}',NULL,NULL,'{}')".format(pname,
Age,Gen,ID,ph,email,nat,f)
cur.execute(q)
x,y=class_seat_pre()
q1="update passenger set Class='{}',Seat='{}' where
p_name='{}'".format(x,y,pname)
cur.execute(q1)
con.commit()
break
else:
print('NO FLIGHTS AVAILABLE! Try Again!')
fch=int(input('Enter your choice:'))
continue
print("-----Details recorded-----")
def payment():
19
print("How would like to pay:1.CREDIT/DEBIT CARD
2.NETBANKING :")
ch=int(input("Enter choice of payment"))
if ch==1:
card_num=int(input("enter your 16-digit card number"))
doe=input("date of expiry (dd/mm/yyyy)")
cvv=int(input("enter cvv"))
print("...")
print()
while True:
otp=input("enter the 6 digit OTP sent to your phone")
if len(otp)==6:
print("payment successful")
break
else:
print("re-enter otp")
elif ch==2:
acc_num=int(input("enter your account number"))
cif=input("enter your CFI number")
branch_code=input("enter branch code")
captcha="Q$r@509%"
print(captcha)
z=input("enter captcha")
print("PLEASE WAIT WHILE YOUR TRANSACTION IS
BEING PROCESSED")
20
while True:
otp=input("enter the 6 digit OTP sent to your phone")
if len(otp)==6:
print("payment successful")
break
else:
print("re-enter otp")
def billgenerate():
q="select flight.f_no,f_name,
Source,Departure_Date_time,Destination,Arrival_Date_time,Durati
on,p_name,phone_no,class,Seat from flight,passenger where
flight.f_no=passenger.f_no"
cur.execute(q)
data=cur.fetchall()
d=input('Enter ph.no number')
foch=input("Would you like a curated meal from our kitchen?")
if foch.upper()=='YES':
print('Comet super saver meal:Rs500')
n=int(input('How many meals would u like to have?'))
fp=n*500
else:
fp=0
for i in data:
if i[8]==d:
import csv
21
f=open('Ticket.csv','w',newline='')
wobj=csv.writer(f,delimiter=',')
wobj.writerow(['Flightno','Flightname','Source','Departure-
Date&Time','Destination','Arrival-Date&Time','Duration'])
wobj.writerow([i[0],i[1],i[2],i[3],i[4],i[5],i[6]])
wobj.writerow(['PassengerName','PhoneNo','Class','Seat','Services'])
if fp==0:
s='Nil'
else:
s='YES'
wobj.writerow([i[7],i[8],i[9],i[10],s])
print('Total price')
if i[9]=='Economy class':
price=7000+fp
elif i[9]=='Business class':
price=15000+fp
elif i[9]=='First class':
price=30000+fp
print("your grand total :Rs",price)
payment()
print()
print()
print()
22
def cancelticket():
phno=input('enter phone number to cancel:')
q='select * from passenger where phone_no="{}"'.format(phno)
cur.execute(q)
data=cur.fetchall()
for i in data:
if i[4]==phno:
s=i[8]
q1='delete from passenger where
phone_no="{}"'.format(phno)
cur.execute(q1)
con.commit()
if s.startswith('E'):
E.append(s)
ref=0.25*7000
refund=7000-ref
print('Refund: Rs',refund)
elif s.startswith('B'):
B.append(s)
ref=0.40*15000
refund=15000-ref
print('Refund: Rs',refund)
elif s.startswith('F'):
F.append(s)
23
ref=0.50*30000
refund=30000-ref
print('Refund: Rs',refund)
print('-----Ticket Cancelled-----')
k=[5,5,4,5,3]
def rating():
print('HOW MUCH WILL YOU RATE OUR SERVICES? 1-5')
n=int(input('Enter rating:'))
k.append(n)
f=sum(k)/len(k)
print("thank you for rating our services")
while True:
print("1.Create table flight")
print("2.Insert flight details")
print("3.Create table passenger")
print('4.Insert table passenger')
print('5.Bill generation And Payment')
print('6.Cancellation of ticket')
print('7.Exit Comet Airlines')
n=int(input("Enter choice"))
if n==1:
create_flight()
24
elif n==2:
insert_flight()
elif n==3:
create_passenger()
elif n==4:
np=int(input('Enter no of reservations to make:'))
for i in range(np):
inputpass()
elif n==5:
billgenerate()
elif n==6:
cancelticket()
else:
rating()
con.close()
print('Thank you for choosing Comet Airlines...Have a nice
day')
break
25
OUTPUT
26
27
28
29
30
31
32
ADVANTAGES
Eco-friendly paperwork can be avoided.
Efficient control over passenger data
Cost-efficient and user-friendly.
Easy access to bill amounts.
Contains step by step flow of execution as each
process is executed as a level.
DISADVANTAGES
The drawbacks in Airline Management system software can
be counted on fingers; with mostly only benefits, these
systems have a few countable downsides.
Absence of proper internet-network makes it difficult
for a user to access information.
Alignment error in output.
Limited number of flights
Same fare disregarding the distance of journey.
33
FUTURE ENHANCEMENT OF THE
PROJECT
This project helps in efficient control over passenger data.
It will help in efficient progressing of airlines complex
details in just two tables. It is mainly employed for charging
fees based on services performed rather than time spent on
a task. It would maintain the punctuality and time
management but there are still improvements and
enhancements that can be developed
Some of the possible enhancements:
Availability of tickets in various flights to be displayed
separately
In case of bulk booking, bill generation to be made
cumulatively for easy payments
Features like cab services, travel insurances, Hotels,
travel history etc to be developed
Individual passenger accounts has to be created
34
BIBLIOGRAPHY
WEBSITES:
1. www.python.org
2. www.mysql.org
3. www.google.com
35
36