0% found this document useful (0 votes)
18 views19 pages

Class XII Computer Science Project 1 (1) - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views19 pages

Class XII Computer Science Project 1 (1) - 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

AIR TICKET RESERVATION

TABLE OF CONTENTS

1. Project Description
2. Glimpses of Python
3. Glimpses of MySQL
4. Hardware and
Software Configuration
5. Tables in the Database
6. Source code
7. Output
8. Bibliography
PROJECT DESCRIPTION

The project Air ticket reservation uses Python as front end and MySql as backend. It
aims to maintain the details of booking, payment, seats and flights. It tracks all the
details about seats, flights and payments and prints various report as per input given
by the user.

Ticket details are stored in Mysql table for easy booking.


The following functionalities are included in the project:
 Entering passenger details.
 Selecting class type.
 Customizing food menu.
 Displaying the total amount including all the extra expenses.
GLIMPSES OF PYTHON
 Python is a high-level, general-purpose, self- contained programming
language designed to meet the needs of computer scientists, software
developers and college students interested in coding.

 Python was created in the early 1980s by Guido van Rossum.

 Python is a high-level, interpreted, dynamic object-oriented


programming language that can be used to program applications or web
sites.

 It is also known as an object-oriented programming (OOP) language. The


main benefits of using Python instead of other languages are that it is very
easy to start programming with and because of its flexible syntax, it can be
used to program almost any kind of software application.

 Python is an open source language that’s free to use and has a wide range
of features that make it easy to customize.
PYTHON FEATURES AND ADVANTAGES
 Easy to Learn:

Simple, readable syntax makes it beginner-friendly.

 Versatile:

Used in web, AI, data analysis, automation, and more.

 Extensive Libraries:

Comes with a large library for various tasks.

 Cross-Platform:

Works on Windows, macOS, Linux, and more.

 Community Support:

Large, active community for help and resources.

 Integration Friendly:

Works well with other languages and tools.

 Rapid Development:

Speeds up coding with fewer lines and reusable code.

 Open Source:

Free to use and supported by developers globally.


GLIMPSES OF MYSQL
MySQL is a system that helps to store and manage data efficiently. Database
generally stores data in a structured fashion.

SALIENT FEATURES OF MYSQL


Quick and Reliable
MySQL stores data efficiently in the memory ensuring that data is consistent, and
not redundant. Hence, data access and manipulation using MySQL is quick.
Free to download
MySQL is free to use so that we can download it from MySQL official website
without any cost.
Scalable
Scalability refers to the ability of systems to work easily with small amounts of
data, large amounts of data, clusters of machines, and so on. MySQL server was
developed to work with large databases.
Data Types
It contains multiple data types such as unsigned integers, signed integers, float
(FLOAT), double (DOUBLE), character (CHAR), variable character (VARCHAR), text,
blob, date, time, datetime, timestamp, year, and so on.
Secure
It provides a secure interface since it has a password system which is flexible, and
ensures that it is verified based on the host before accessing the database. The
password is encrypted while connecting to the server.
Support for large databases
MySQL has no limit on the number of databases. The underlying filesystem may
have a limit on the number of directories. MySQL has no limit on the
number of tables. The underlying file system may have a limit on the number of
files that represent tables. Individual storage engines may impose engine-specific
constraints. InnoDB permits up to 4 billion tables.
Client and Utility Programs
MySQL server also comes with many client and utility programs. This includes
Command line programs such as ‘mysqladmin’ and graphical programs such as
‘MySQL Workbench’. MySQL client programs are written in a variety of languages.
Client library (code encapsulated in a module) can be written in C or C++ and
would be available for clients that have C bindings.
Compatible on many operating systems
MySQL is compatible to run on many operating systems, like Novell NetWare,
Windows* Linux*, many varieties of UNIX* (such as Sun*Solaris*, AIX, and DEC*
UNIX), OS/2, FreeBSD*, and others. MySQL also provides a facility that the clients
can run on the same computer as the server or on another computer
(communication via a local network or the Internet).
GUI Support
MySQL provides a unified visual database graphical user interface tool named
"MySQL Workbench" to work with database architects, developers, and Database
Administrators.
HARDWARE AND
SOFTWARE
CONFIGURATION
HARDWARE
Operating System: Windows 10 or above

Processor : Pentium 2.6GHz

RAM : 4GB

HardDisk : SSD 128GB

SOFTWARE
Windows OS

Python 3.8 or above

MySQL 8.0 Command Line Client


TABLES IN THE DATABASE
SOURCE CODE
import os
import platform
import datetime
import mysql.connector as ms
mydb = ms.connect(user='root', password='password', host='localhost',
database='crazy_airlines')
mycursor=mydb.cursor()

def luggagebill():
global z
print("Do you want to see rate for luggage : Enter 1 for yes :")
ch=int(input("enter your choice:"))
if ch==1:
sql="select * from luggage"
mycursor.execute(sql)
rows=mycursor.fetchall()
print(rows)
y=int(input("Enter Your weight of extra luggage->"))
z=y*2000
print("your luggage bill:",z,"\n")
Menuset()

def ticketamount():
a=input("enter customer name:")
print("customer name :",a,"\n")
print("luggage bill:",z)
print("ticket cost:", c)
print("food bill:",s)
print("Total amount:",z+s+c+1000)
Menuset()
def Menuset():
print("AIR TICKET RESERVATION")
print("1: To enter customer data")
print("2 : for class type")
print("3 : for food bill")
print("4 : for luggage bill")
print("5 : for complete amount")
print("6 : for exit")
try:
userinput=int(input("please select an above option:"))
except ValueError:
exit("\n hi thats not a number")
userinput=int(input("confirm your option:"))
if(userinput==1):
registercust()
elif(userinput==2):
classtype()
elif(userinput==3):
orderitem()
elif(userinput==4):
luggagebill()
elif(userinput==5):
ticketamount()
elif(userinput==6):
print("THANKYOU FOR CHOOSING OUR AIRLINES :)")
quit()
else:
print("enter correct choice")

def registercust():
L=[]
name=input("enter name:")
L.append(name)
addr=input("enter address:")
L.append(addr)
jr_date=input("enter date of journey(YYYY-MM-DD):")
L.append(jr_date)
source=input("enter departure:")
L.append(source)
destination=input("enter destination:")
L.append(destination)
cust=(L)

sql="insert into\
pdata(customer_name,address,jrdate,departure,destination)values(%s,%s,%s,%s,%s)"
mycursor.execute(sql,cust)
mydb.commit()
sb=input("do you want to add more records(y/n)?")
if (sb=="y"):
registercust()

def classtype():
global c
print ("We have the following rooms for you:-")
print ("1. type First class >rs 60000 PN\-")
print ("2. type Business class >rs 40000 PN\-")
print ("3. type Economy class >rs 20000 PN\-")
x=int(input("Enter Your Choice Please->"))
n=int(input("No of passenger:"))
if(x==1):
print ("you have opted First class")
c=60000*n
elif (x==2):
print ("you have opted Business class")
c=40000*n
elif (x==3):
print ("you have opted Economy class")
c=20000*n
else:
print ("please choose a class type")
print ("your room rent is =",s,"\n")
Menuset()

def orderitem():
global s
print("Do you want to see menu available : Enter 1 for yes :")
ch=int(input("enter your choice:"))
if ch==1:
sql="select * from food"
mycursor.execute(sql)
rows=mycursor.fetchall()
print(rows)
ans='y'
while ans=='y':
print("for odering your food,enter the respective number:")
d=int(input("enter your choice:"))
if(d==1):
print("you have ordered tea")
a=int(input("enter quantity"))
s=200*a
print("your amount for tea is :",s,"\n")
elif (d==2):
print("you have ordered coffee")
a=int(input("enter quantity"))
s=250*a
print("your amount for coffee is :",s,"\n")
elif(d==3):
print("you have ordered colddrink")
a=int(input("enter quantity"))
s=400*a
print("your amount for colddrink is :",s,"\n")
elif(d==4):
print("you have ordered french fries")
a=int(input("enter quantity"))
s=500*a
print("your amount for french fries is :",s,"\n")
elif(d==5):
print("you have ordered sandwich")
a=int(input("enter quantity"))
s=600*a
print("your amount for sandwich is :",s,"\n")
elif(d==6):
print("you have ordered nuggets ")
a=int(input("enter quantity"))
s=500*a
print("your amount for nuggets is :",s,"\n")
elif(d==7):
print("you have ordered pizza")
a=int(input("enter quantity"))
s=1000*a
print("your amount for pizza is :",s,"\n")
elif(d==8):
print("you have ordered milk")
a=int(input("enter quantity"))
s=100*a
print("your amount for milk is :",s,"\n")
elif(d==9):
print("you have ordered spaghetti")
a=int(input("enter quantity"))
s=750*a
print("your amount for spaghetti is :",s,"\n")
elif(d==10):
print("you have ordered macaroni")
a=int(input("enter quantity"))
s=750*a
print("your amount for macaroni is :",s,"\n")
else:
print("invalid option")
ans=input("do u want to continue y/n")
else:
Menuset()

def res():
print(s)

print(ticketamount)

Menuset()
def runagain():
runagn=input("\n want to run again y/n:")
if (runagn.lower()=='y'):
Menuset()
else:
print("THANK YOU FOR YOUR COOPERATION")
quit()

runagain()
OUTPUT
BIBLIOGRAPHY

 Computer Science with Python – Sumita Arora


Preethi Arora.

 http://www.google.com/

 http://www.scribd.com/

You might also like