1.
ABSTRACT
Air Reservation System is a software which is helpful for booking tickets and as well as to know details about
plights. In the current system all the activities are done manually. It is time saving and scalable. air reservation
system deals with varies activities related to airport.
The passengers can find and book tickets for flights through this software. This project contains the details of Air
Reservation System in terms of all the significant information about plights, in the form of SQL Database.
It provides good level of security so it takes care of the user’s safety concerns as well One can compare the best
deals for them and book a flight accordingly. When the passengers enter all are seats available on that particular
flight. The manual work is thus reduced and the chances of errors are reduced to minimum.
2.INTRODUCTION
2.1. PYTHON:
Python is a high-level, general-purpose programming language. Its design philosophy
emphasizes code readability with the use of significant indentation . Python is dynamically
typedandgarbage-collected.Itsupportsmultipleprogrammingparadigms,includingstructured
(particularly procedural), object-oriented and functional programming.
It is often described as a "batteries included" language due to its comprehensive standard
library.GuidovanRossumbeganworkingonPythoninthelate1980sasasuccessortothe ABC
programming language and first released it in 1991 as Python 0.9.0. Python 2.0 was released
in 2000.
Python3.0,releasedin2008,wasamajorrevisionnotcompletelybackward-compatiblewith
earlier versions. Python 2.7.18, released in 2020, was the last release of Python 2 . Python
consistently ranks as one of the most popular programming languages, and has gained
widespread use in the machine learning community.
PYTHONFEATURES:
Easy-to-learn:Pythonhasfewkeywords,simplestructure,andaclearlydefinedsyntax. This
allows the student to pick up the language quickly.
Easy-to-read:Pythoncodeismoreclearlydefined andvisibletotheeyes.
Easy-to-maintain:Python'ssourcecodeisfairly easy-to-maintain.
Abroadstandardlibrary:Python'sbulkofthelibraryisveryportableandcross-platform compatible
on UNIX, Windows, and Macintosh.
InteractiveMode:Pythonhassupportforaninteractivemodewhichallowsinteractivetesting and
debugging of snippets of code.
Portable-Pythoncanrunonawidevarietyofhardwareplatformsandhasthesameinterface on all
platforms.
Extendable-youcanaddlow-levelmodulestothePythoninterpreter.Thesemodulesenable
programmers to add to or customize their tools to be more efficient.
Databases-Pythonprovidesinterfacestoallmajorcommercialdatabases.
GUIProgramming-PythonsupportsGUIapplicationsthatcanbecreatedandportedtomany system
calls, libraries and windows systems, such as Windows MFC, Macintosh, and the X Window
system of Unix.
Scalable-Pythonprovidesabetterstructure andsupportforlargeprogramsthanshell scripting.
Pythongraphicaluserinterfaces(GUIS):
Tkinter-TkinteristhePythoninterfacetotheTkGUItoolkitshippedwithPython.Wewould look this
option in this chapter.
wxPython-Thisisanopen-sourcePythoninterfacefor wxWindows
JPython-JPythonisaPythonportforJavawhichgivesPythonscriptsseamlessaccesstoJava class
libraries on the local machine
2.2.CSV:
Comma Separated Values files, are plain text files with each piece of data on its own line, and each line is
delimited by commas or semicolons. They aid with moving information from one application to another. Tabular
spreadsheet data from one program is converted into a CSV file, which is then used to import the information into
another program.
In Microsoft Excel, CSVs function as a type of external data source that can be used to import and export data
from spreadsheets. The CSV file format is compatible with all the major programming languages, including
Python, Ruby, and JavaScript, which have built-in functions for reading and writing CSVs.
Favored for their flexibility, CSVs can be opened in a text editor such as Microsoft Notepad or Apple TextEdit,
making it easy to view and edit datasets. They are also simpler to manipulate and analyze when opened in
spreadsheet programs like Google Sheets or Apple Numbers.
FEATURES OF CSV:
The files have a simple structure and are human-readable;
The data can be easily imported or exported into other programs;
CSV file format can be easily and accurately compressed;
The running costs are not high;
Perfect fit for getting data out of one application and into another one;
2.3.MATPLOTLIB:
Matplotlib is a python library used to create 2D graphs and plots by using python scripts. It has a module named
pyplot which makes things easy for plotting by providing feature to control line styles, font properties, formatting
axes etc. It supports a very wide variety of graphs and plots namely - histogram, bar charts, power spectra, error
charts etc. It is used along with NumPy to provide an environment that is an effective open source alternative for
MatLab. It can also be used with graphics toolkits like PyQt and wxPython.
Conventionally, the package is imported into the Python script by adding the following statement ?frommatplotlib
import pyplot as plt
The pyplot API has a convenient MATLAB-style stateful interface. In fact, the matplotlib Python library was
originally written as an open source alternative for MATLAB. The OO API and its interface is more customizable
and powerful than pyplot, but considered more difficult to use. As a result, the pyplot interface is more commonly
used, and is referred to by default in this article.
Understanding matplotlib’spyplot API is key to understanding how to work with plots:
matplotlib.pyplot.figure: Figure is the top-level container. It includes everything visualized in a plot including one
or more Axes.
matplotlib.pyplot.axes: Axes contain most of the elements in a plot: Axis, Tick, Line2D, Text, etc., and sets the
coordinates. It is the area in which data is plotted. Axes include the X-Axis, Y-Axis, and possibly a Z-Axis, as
well.
FEATURES OF MATPLOTLIB:
Create publication quality plots.
Make interactive figures that can zoom, pan, update.
Customize visual style and layout.
Export to many file formats.
Embed in JupyterLab and Graphical User Interfaces.
Use a rich array of third-party packages built on Matplotlib.
1.1 OVERVIEWOFPYTHONMODULES:
SomePredefinedModulesofPython:
NumpyisthecorelibraryforscientificcomputinginPython.Itprovidesahigh-
Numpy performance multidimensional array object, and tools for working with these
arrays.
MySQL PythonneedsaMySQLdrivertoaccess theMySQLdatabase.
MatplotlibisavisualizationlibraryinPythonfor2Dplotsofarrays.Matplotlibisa multi-
matplotlib platform data visualization library built on NumPy arrays and designed to work
with the broader SciPy stack.
CSV PythonprovidesaCSVmoduletohandleCSVfiles.Toread/writedata,youneed to loop
through rows of the CSV.
Datetime Thedatetimemodulesuppliesclassesformanipulatingdatesandtimesinboth simple
and complex ways.
random Functions in the random module depend on a pseudo-random number generator
functionrandom(),whichgeneratesarandomfloatnumberbetween0.0and1.0.
Theseincludetrigonometricfunctions,representationfunctions,logarithmic
Math functions, angle conversion functions, etc. In addition, two mathematical
constants are also defined in this module.
1.1 MySQL:
MySQL is a relational database management system (RDBMS) based on the SQL queries.
Itisoneofthemostpopularlanguagesforaccessing andmanagingtherecordsinthetable.MySQL
isopen-sourceandfreesoftwareundertheGNUlicense.OracleCompanysupportsit.Itsnameis a
combination of "My", the name of co-founder Michael Widenius's daughter My, and "SQL", the
acronym for Structured Query Language. MySQL is a relational database management system.
This database language is based on the SQL queries to access and manage the records of the
table.
FeaturesofMYSQL:
Easyto use:
MySQLiseasytouse.WehavetogetonlythebasicknowledgeofSQL.Wecanbuildandinteract with
MySQL by using only a few simple SQL statements.
Itissecure:
MySQLconsistsofasoliddatasecuritylayerthatprotectssensitivedatafromintruders.Also,
passwords are encrypted in MySQL.
Client/ServerArchitecture:
MySQLfollowstheworkingofaclient/serverarchitecture.Thereisadatabaseserver(MySQL) and
arbitrarily many clients (application programs), which communicate with theserver; that is,
they can query data, save changes, etc.
Freetodownload:
MySQLisfreetousesothatwecan downloaditfromMySQLofficialwebsitewithoutany cost.
Itis scalable:
MySQLsupportsmulti-threadingthatmakesiteasilyscalable.Itcanhandlealmostanyamount of
data, up to as much as 50 million rows or more. The default file size limit is about 4 GB.
However, we can increase this number to a theoretical limit of 8 TB of data.
Speed:
MySQLisconsideredoneoftheveryfastdatabaselanguages,backedbyalargenumberofthe
benchmark test.
1.2 PYTHONWITHMYSQLCONNECTOR:
TheMySQLconnectorisa"Database"connector,meaningitretrievesdatafromadatabaseusing a
query. In the Data Center, you can access the connector page for this and other Database
connectorsbyclickingDatabaseinthetoolbaratthetopofthewindow.MySQLConnector/Python
enables Python programs to access MySQL databases, using an API that is compliant with the
Python Database API Specification v2.
3.SYSTEM REQUIREMENTS
3.1.HARDWARE REQUIREMENTS:
I.PROCESSOR : Intel(R) Core(TM) i5-6500T CPU @ 2.50GHz 2.50 GHz
II.RAM : 8.00 GB
III.HARD DISK : 512TB
3.2.SOFTWARE REQUIREMENTS:
Windows 10
Spyder (Anaconda3) version 5
MySQL (Command Line Client) Version 5.5
3.OBJECTIVE OF THE PROJECT
This software helps passengers to look up flights between two points which can be domestic
or international. The passengers can find and book tickets for flights through this software.
Developed in Phython, it is fairly easy to use software having a user-friendly interface.
The main objective is to reduce the mistakes which creep up in
manual systems. It provides good level of security so it takes care of the user's safety
concerns as well. Passengers can access the whole list of all the flights available on different
routes with their timings and fare both for economy and business classes.
One can compare the best deals for them and book a flight accordingly. The manual work is
thus reduced and the chances of errors are reduced to minimum.
5.MODULES PURPOSES AND CODING
5.1.MODULES USED:
Pandas
Matplotlib
MySQL Connector
OS
Platform
Datetime
5.1.1.PANDAS:
Pandas is a Python package providing fast, flexible, and expressive data structures designed
to make working with “relational” or “labeled” data both easy and intuitive. It aims to be the
fundamental high-level building block for doing practical, real-world data analysis in Python.
Additionally, it has the broader goal of becoming the most powerful and flexible open source
data analysis/manipulation tool available in any language. It is already well on its way toward
this goal.
The two primary data structures of pandas, Series (1-dimensional) and DataFrame (2-
dimensional), handle the vast majority of typical use cases in finance, statistics, social
science, and many areas of engineering.
For R users, DataFrame provides everything that R’s dataframe provides and much more.
Pandas is built on top of NumPy and is intended to integrate well within a scientific
computing environment with many other 3rd party libraries. Pandas is fast.
Many of the low-level algorithmic bits have been extensively tweaked in Cython code.
However, as with anything else generalization usually sacrifices performance. So if you focus
on one feature for your application you may be able to create a faster specialized tool.
Pandas is a dependency of stats models, making it an important part of the statistical
computing ecosystem in Python. Pandas has been used extensively in production in financial
applications.
5.1.2.PYPLOT:
Pyplot is a Matplotlib module that provides a MATLAB-like interface. Matplotlib is designed
to be as usable as MATLAB, with the ability to use Python and the advantage of being free
and open-source. Each pyplot function makes some changes to a figure: e.g., creates a figure,
creates a plotting area in a figure, plots some lines in a plotting area, decorates the plot with
labels, etc. The various plots we can utilize using Pyplot are Line Plot, Histogram, Scatter, 3D
Plot, Image, Contour, and Polar.
5.1.3.MYSQL CONNECTOR:
MySQL is a Relational Database Management System (RDBMS) whereas the structured
Query Language (SQL) is the language used for handling the RDBMS using commands i.e
Creating, Inserting, Updating and Deleting the data from the databases. SQL commands are
case insensitive i.e CREATE and create signify the same command.
In this article, we will be discussing the MySQL Connector module of Python, how to install
this module and a piece of code on how to connect this with the MySQL database. For any
application, it is very important to store the database on a server for easy data access.
5.1.4.PLATFORM:
Python defines an in-built module platform that provides system information.The Platform
module is used to retrieve as much possible information about the platform on which the
program is being currently executed. Now by platform info, it means information about the
device, it’s OS, node, OS version, Python version, etc.
This module plays a crucial role when you want to check whether your program is
compatible with the python version installed on a particular system or whether the
hardware specifications meet the requirements of your program.
This module already exists in the python library and does not require any installation
using pip.
5.1.5.OS:
The OS module in Python provides functions for interacting with the operating system. OS
comes under Python’s standard utility modules. This module provides a portable way of using
operating system-dependent functionality. The *os* and *os.path* modules include many
functions to interact with the file system
5.1.6.DATETIME:
Python Datetime module supplies classes to work with date and time. These classes
provide a number of functions to deal with dates, times, and time intervals. Date and
DateTime are an object in Python, so when you manipulate them, you are actually
manipulating objects and not strings or timestamps.
Its a combination of date and time along with the attributes year, month, day, hour, minute,
second, microsecond, and tzinfo.
SOURCE CODE:
importos
import platform
importdatetime
import pandas as pd
importmysql.connector
importmatplotlib.pyplot as plt
mydb=mysql.connector.connect(host="localhost",user="root",passwd="123456",charset="utf
8")
mycursor=mydb.cursor()
mycursor.execute("create database if not exists air_service")
mycursor.execute("use air_service")
defregistercust():
L=[]
custno=int(input('Enter Customer No :'))
L.append(custno)
name=input('Enter Name :')
L.append(name)
addr=input('Enter Address :')
L.append(addr)
jr_date=input('Enter Date Of Journey :')
L.append(jr_date)
source=input('Enter Source (From) :')
L.append(source)
destination=input('Enter Destination (To) :')
L.append(destination)
cust=(L)
mycursor.execute('use air_service')
mycursor.execute("create table if not exists
pdata(custnoint,custnamevarchar(30),addrvarchar(30),jrdatedate,sourcevarchar(30),destinatio
n varchar(30))")
sql='insert into pdata(custno,custname,addr,jrdate,source,destination) values(%s,%s,%s,%s,
%s,%s)'
mycursor.execute(sql,cust)
mydb.commit()
xum=[custno,name,addr,jr_date,source, destination]
y=['CUSTOMER_NO','NAME','ADDRESS','JR_DATE','SOURCE','DESTINATION']
z=pd.DataFrame(xum,index=y)
z.to_csv("Register.csv")
defticketprice():
L=[]
cno=int(input('Enter Customer No :'))
L.append(cno)
print('We Have The Following Rooms For You :-')
print('1. Type First Class--->Rs 6000 PN\-')
print('2. Type Business Class--->Rs 4000 PN\-')
print('3. Type Economy Class--->Rs 2000 PN\-')
x=int(input('Enter Your Choice :'))
n=int(input('Enter No Of Passengers :'))
if x==1:
print('You Have Opted First Class.')
s=6000*n
L.append(s)
elif x==2:
print('You Have Opted Business Class.')
s=4000*n
L.append(s)
elif x==3:
print('You Have Opted Economy Class.')
s=2000*n
L.append(s)
else:
print('Please Select A Class Type.')
print('Your Ticket Charge Is =',s,'\n')
print('Extra Luggage Charge 100 RS Per KG')
y=int(input('Enter Your Weight,Of Extra Luggage :'))
z=y*100
L.append(z)
tkt=(L)
print('Your Totalbill:',s+z,'\n')
g_tot=s+z
L.append(g_tot)
mycursor.execute('use air_service')
mycursor.execute("create table if not exists tkt(custnoint,tkt_totint,lug_totint,g_totint)")
sql="insert into tkt (custno,tkt_tot,lug_tot,g_tot) values (%s,%s,%s,%s)"
mycursor.execute(sql,tkt)
mydb.commit()
r=[cno,s,z,g_tot]
o=['CUSTOMER_NO','TICKET_TOTAL','LUGGAGE_TOTAL','TOTAL']
v=pd.DataFrame(r,index=o)
v.to_csv("Ticket.csv")
def dis():
custno=int(input("Enter The Customer Number Whose Bill To Be Viewed : "))
sql="Select pdata.custno, pdata.custname,
pdata.addr,pdata.source,pdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot from pdata INNER
JOIN tkt ON pdata.custno=tkt.custno and tkt.custno = %s;"
rl=(custno,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
for x in res:
print(x)
defdispall():
sql="Select pdata.custno, pdata.custname,
pdata.addr,pdata.source,pdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot from pdata INNER
JOIN tkt ON pdata.custno=tkt.custno;"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The Customer Details Are As Follows : ")
for x in res:
print(x)
defMenuset():
print('Enter 1: To Enter Customer Data.')
print('Enter 2: For Ticket Amount.')
print('Enter 3: Display Customerwise Details.')
print('Enter 4: Display All Details.')
print('Enter 5: Flight Details.')
print('Enter 6: Exit.')
userinput=int(input('Enter Your Choice:'))
ifuserinput==1:
registercust()
elifuserinput==2:
ticketprice()
elifuserinput==3:
dis()
elifuserinput==4:
dispall()
elifuserinput==5:
plightdetails()
elifuserinput==6:
exit(0)
else:
print('Enter Correct Choice.')
defplightdetails():
L=[]
x=int(input('Flights Available :'))
L.append(x)
y=input('Flights Waiting :')
L.append(y)
z=input('Flights Onboard :')
L.append(z)
s=input('Coming Up Flights :')
L.append(s)
ra=['FLIGHTS AVAIL','FLIGHTS WAIT','FLIGHTS ONBOARD','COMING FLIGHTS']
ri=[x,y,z,s]
h=pd.DataFrame(ri,index=ra)
h.to_csv('Flight Details.csv')
plt.plot(ra,ri)
plt.show()
plt.savefig('Flight Details.pdf')
Menuset()
defrunagain():
runagn=input('Want To Run Again? y/n :')
whilerunagn=='y':
ifplatform.system=='windows':
print(os.system('cls'))
else:
print(os.system('clear'))
Menuset()
runagn=input('Want to run again? y/n :')
runagain()
6.RESULT
7.BIBILOGRAPHY
Python.org
Sumit Arora Class 11 IP TextBook
Sumit Arora Class 12 IP TextBook
Arora Class 12 CS TextBook
Geeksforgeeks.org