0% found this document useful (0 votes)
37 views36 pages

Cs Project Z

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)
37 views36 pages

Cs Project Z

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/ 36

1

INDEX

SNO CONTENT PAGE NO

1 Hardware and Software 3


requirements

2 Theoretical background 4

3 Program description 9

4 Functions used 11

5 Program 13

6 Output 26

7 Advantages and Disadvantages 33

8 Future enhancement of the Project 34

9 Bibliography 35

2
HARDWARE REQUIREMENTS

 Processor- Intel Core 15


 Input and Output devices

SOFTWARE REQUIREMENTS

 Operating System- Windows 10

 Python [Version 3.7]

 MySQL [Version 5.7]

3
THEORETICAL BACKGROUND

WHAT IS PYTHON?

Python is an interpreter. It is a high-level and general-


purpose programming language which emphasizes code
readability with its notable use of significant whitespace.
Its language constructs an object-oriented approach
which aims to help programmers write a clear, logical
code for small and large-scale projects. Python is
dynamically typed and it supports multiple programming
paradigms, including structured (particularly,
procedural), object-oriented and functional
programming. Python interpreters are supported for
mainstream operating systems and available for a few
more. A global community of programmers develops and
maintains C Python, a free and open-source reference
implementation. A non- profit organization, the Python
Software Foundation, manages and directs resources for
Python and C Python development.

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.

However, the most important change was to the


development process itself, with a shift to a more
transparent and community-backed process. Python 3.0, a
major, backwards-incompatible release, was released on
December 3, 2008 after a long period of testing. Many of
its major features have also been back ported to the
backwards-compatible, while by now unsupported, Python
2.6 and 2.7.

WHAT IS A DATABASE?

Database is a collection of information that is organised


so as to access them easily and quickly. In a relational
database, the digital information are arranged into rows,
columns and tables which are indexed to access the
relevant information. There are different kinds of
databases ranging for the most approached relational

5
database, to a distributed database, cloud database,
graph database or NoSQL database.

RELATIONAL DATABASE:

A relational database, invented by E.F. Codd at IBM in


1970, is a tabular database in which data is defined so
that it can be reorganized and accessed in a number of
different ways. Relational databases are made up of a set
of tables with data that fits into a predefined category.
Each table has at least one data category in a column, and
each row has at certain data instance for the categories
which are defined in the columns. Relational databases
are easy to extend, and a new data category can be added
after the original database creation without requiring
that you modify all the existing applications.

RELATIONAL DATABASE MANAGEMENT SYSTEM:


A relational database management system shortly called
as RDBMS is a Database management system that is
designed specifically for relational databases. It is the
software that executes queries on the data, including
adding, updating, and searching for values. An RDBMS
may also provide a visual representation of the data. For

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?

SQL (Structured Query Language) is a domain-specific


language used in programming and designed for
managing data held in a relational database
management system (RDBMS), or for stream processing
in a relational data stream management system (RDSMS).
It is particularly useful in handling structured data, i.e.
data incorporating relations among entities and
variables. SQL offers two main advantages over older
read-write APIs. Firstly, it introduced the concept of
accessing many records with one single command.
Secondly, it eliminates the need to specify how to reach a
record, e.g. with or without an index.

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

This project aims to provide an user friendly application


program for passengers who travel frequently through
air by helping them to book tickets , generating an
invoice and cancellation services. It achieves these
objectives by storing data in a more efficient organised
and concise manner. Using python programming and
SQL databases, an easy and user friendly software can
be created for airline and passengers alike making the
process seem frictionless.

The main objective of the python program on air ticket


reservation is to manage and monitor information of
booking, transactions , seats and ticket cancellations.
With the help of the system passengers can view
availability of different flights, it allows them to reserve
a seat of their choice and cancel a reservation.

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)

q4="insert into flight values('1H4678','Starlight','New York','Mon


18/Mar/24 19:45','Kolkata','Tue 19/Mar/24 14:55','19hr10min')"
cur.execute(q4)

q5="insert into flight values('2D2698','Cloud9','Assam','Tue


9/Apr/24 06:40','Delhi','Tue 9/Apr/24 09:10','2hr30min')"
cur.execute(q5)

q6="insert into flight values('3J7077','Ad Astra','Delhi','Wed


17/Apr/24 12:00','Austin','Thur 18/Apr/24 21:30','21hr30min')"
cur.execute(q6)
con.commit()
print('-----Flight data inputed-----')

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

E=['E'+str(i+1) for i in range(20)]


B=['B'+str(i+1) for i in range(20)]
F=['F'+str(i+1) for i in range(20)]

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

 Class XII NCERT Textbook

 Python Class XI and XII Sumita Arora

 WEBSITES:
1. www.python.org
2. www.mysql.org
3. www.google.com

The project reference is taken from - www.makemytrip.com

35
36

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy