INFORMATICS PRACTICES
ADARSH PUBLIC SCHOOL
NOIDA , UTTAR PRADESH
Session:- (2024-2025)
Air ticket reservation
NAME : VIPIN YADAV
ROLL NO. :
CLASS : XII B
SUBJECT : INFORMATICS PRACTICES
SUB CODE : 065
PROJECT GUIDE : Mrs. Priti Rani
PGT IP
VIPIN YADAV XII B 1
INFORMATICS PRACTICES
PROJECT ON
Air ticket reservation
VIPIN YADAV XII B 2
INFORMATICS PRACTICES
CERTIFICATE
This is to certify that Project File is successfully completed bymVIPIN
YADAV of Class: XII, Division: B Roll no. :_________________
for the academic year 2024-2025 in the School Computer lab.
Internal Examiner External Examiner
Principal Ma’am
VIPIN YADAV XII B 3
INFORMATICS PRACTICES
Acknowledgement:
I, Vipin Yadav of class XIIth- B would like to express
our sincere gratitude to our Informatics Practices
teacher Ms. PRITI RANI , PGT INFORMATICS
PRACTICES , for her vital support, guidance and
encouragement – without which this project would
not have come forth.
I would also like to express our gratitude to our school
ADARSH PUBLIC SCHOOL, NOIDA for letting us use
the school laboratory.
VIPIN YADAV XII B 4
INFORMATICS PRACTICES
INDEX
1. Brief Overview of Project
2. Need for Computerization
3. Software and Hardware requirement
4. Advantages of Project
5. Limitations of Project
6. Source Code of Project
7. Output
8. Future Enhancement of Project
9. Bibliography
VIPIN YADAV XII B 5
INFORMATICS PRACTICES
AIR TICKET RESERVATION
BRIEF OVERVIEW OF PROJECT
The main objective of the python project on Air ticket
reservation is to manage the details of booking, payments,
seats, and flights.
The project is totally built at administrative end and only
administrator is guaranteed the access.
The purpose of the project is to build an application
program to reduce the manual work for managing the
booking, meals, and payments.
It tracks all the details about seat category, flight, and
payments.
INPUT DATA AND VALIDATION OF PROJECT
1. All the fields such as flight payments discounts are
validated and does not take invalid values.
2. Each form of food, luggage, bookings cannot accept the
blank values.
3. Avoiding errors in data.
4. Controlling amount of input.
VIPIN YADAV XII B 6
INFORMATICS PRACTICES
Source code
DBMS: MySQL
Host: local host
User: root
Pass: root
Database: hotel
Table Structure: (Images Bellow)
VIPIN YADAV XII B 7
INFORMATICS PRACTICES
VIPIN YADAV XII B 8
INFORMATICS PRACTICES
PYTHON
CODE:
VIPIN YADAV XII B 9
INFORMATICS PRACTICES
import platform
import mysql.connector
import pandas as pd
import datetime
# Establish database connection
mydb = mysql.connector.connect(
user='root', password='vipin', host='localhost',
database='hotel'
)
mycursor = mydb.cursor()
# Global variables
global lugBill, ticketPrice, foodBill, custName
lugBill = 0
ticketPrice = 0
foodBill = 0
custName = "none"
# Function to register a customer
def registercust():
global custName
L = []
name = input("Enter name: ")
L.append(name)
VIPIN YADAV XII B 10
INFORMATICS PRACTICES
addr = input("Enter address: ")
L.append(addr)
jr_date = input("Enter date of journey (YYYY-MM-
DD): ")
L.append(jr_date)
source = input("Enter source: ")
L.append(source)
destination = input("Enter destination: ")
L.append(destination)
cust = tuple(L)
sql = "INSERT INTO pdata (custname, addr, jrdate,
source, destination) VALUES (%s, %s, %s, %s, %s)"
mycursor.execute(sql, cust)
mydb.commit()
custName = L
# Function to view class type
def classtypeview():
print("Do you want to see class type available? Enter
1 for yes:")
ch = int(input("Enter your choice: "))
if ch == 1:
sql = "SELECT * FROM classtype"
mycursor.execute(sql)
rows = mycursor.fetchall()
VIPIN YADAV XII B 11
INFORMATICS PRACTICES
for x in rows:
print(x)
# Function to calculate ticket price
def ticketprice():
global ticketPrice
print("We have the following seat options for you:")
print("1. First class --> Rs. 6000 PN")
print("2. Business class --> Rs. 4000 PN")
print("3. Economy class --> Rs. 2000 PN")
x = int(input("Enter your choice: "))
n = int(input("Number of passengers: "))
if x == 1:
print("You have opted for First class")
s = 6000 * n
elif x == 2:
print("You have opted for Business class")
s = 4000 * n
elif x == 3:
print("You have opted for Economy class")
s = 2000 * n
else:
print("Please choose a valid class type")
return
VIPIN YADAV XII B 12
INFORMATICS PRACTICES
ticketPrice = s
print("Your total fare is:", ticketPrice, "Rs\n")
# Function to view food menu
def menuview():
print("Do you want to see the 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()
for x in rows:
print(x)
# Function to order food items
def orderitem():
global foodBill
print("Do you want to see the food 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()
VIPIN YADAV XII B 13
INFORMATICS PRACTICES
for x in rows:
print(x)
d = int(input("Enter your choice: "))
if d == 1:
print("You have ordered tea")
a = int(input("Enter quantity: "))
s = 10 * a
elif d == 2:
print("You have ordered coffee")
a = int(input("Enter quantity: "))
s = 10 * a
elif d == 3:
print("You have ordered colddrink")
a = int(input("Enter quantity: "))
s = 20 * a
elif d == 4:
print("You have ordered samosa")
a = int(input("Enter quantity: "))
s = 20 * a
elif d == 5:
print("You have ordered sandwich")
a = int(input("Enter quantity: "))
s = 50 * a
elif d == 6:
print("You have ordered pasta")
a = int(input("Enter quantity: "))
VIPIN YADAV XII B 14
INFORMATICS PRACTICES
s = 50 * a
else:
print("Please enter your choice from the menu")
return
foodBill = s
print("Your food bill is:", foodBill, "Rs\n")
# Function to calculate luggage bill
def luggagebill():
global lugBill
print("Do you want to see rates 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()
for x in rows:
print(x)
y = int(input("Enter your weight of extra luggage
(kg): "))
lugBill = y * 1000
print("Your excess luggage bill is:", lugBill, "Rs\n")
VIPIN YADAV XII B 15
INFORMATICS PRACTICES
# Function to show final ticket price
def showFinalTicketPrice():
print("Passenger Name:", custName[0])
print("Date of Journey:", custName[2])
print("Travel Source:", custName[3])
print("Travel Destination:", custName[4])
print("Excess Luggage Bill:", lugBill, "Rs")
print("Food Bill:", foodBill, "Rs")
print("Total Ticket Price:", ticketPrice, "Rs\n")
print("******************************")
# New Function to visualize data
def visualize_data():
print("What would you like to visualize?")
print("1: Class Type Distribution")
print("2: Food Menu Prices")
print("3: Luggage Rates")
try:
choice = int(input("Enter your choice (1-3): "))
except ValueError:
print("Invalid input. Please enter a number
between 1 and 3.")
return
if choice == 1:
VIPIN YADAV XII B 16
INFORMATICS PRACTICES
sql = "SELECT classtype, price FROM classtype"
mycursor.execute(sql)
data = mycursor.fetchall()
if not data:
print("No data found.")
return
classtype, rate = zip(*data)
plt.bar(classtype, rate, color='blue')
plt.title("Class Type Distribution")
plt.xlabel("Class Type")
plt.ylabel("Price (Rs)")
plt.show()
elif choice == 2:
sql = "SELECT itemname, rate FROM food"
mycursor.execute(sql)
data = mycursor.fetchall()
if not data:
print("No data found.")
return
itemname, rate = zip(*data)
plt.bar(itemname, rate , color='green')
plt.title("Food Menu Prices")
plt.xlabel("Food Items")
plt.ylabel("Price (Rs)")
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
VIPIN YADAV XII B 17
INFORMATICS PRACTICES
elif choice == 3:
sql = "SELECT weight, rate FROM Luggage"
mycursor.execute(sql)
data = mycursor.fetchall()
if not data:
print("No data found.")
return
weight, rate = zip(*data)
plt.bar(weight, rate, color='orange')
plt.title("Luggage Rates")
plt.xlabel("Weight Range")
plt.ylabel("Price per Kg (Rs)")
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
else:
print("Invalid choice. Please try again.")
# Main menu function
def Menuset():
print("AIR TICKET RESERVATION")
print("1: To enter customer data")
print("2: To view class")
print("3: To calculate ticket amount")
print("4: To view food menu and order")
print("5: To calculate luggage bill")
VIPIN YADAV XII B 18
INFORMATICS PRACTICES
print("6: To view final ticket amount")
print("7: To visualize data")
print("8: To exit")
try:
userinput = int(input("Please select an option: "))
except ValueError:
exit("That's not a valid number!")
if userinput == 1:
registercust()
elif userinput == 2:
classtypeview()
elif userinput == 3:
ticketprice()
elif userinput == 4:
orderitem()
elif userinput == 5:
luggagebill()
elif userinput == 6:
showFinalTicketPrice()
elif userinput == 7:
visualize_data()
elif userinput == 8:
exit("Thank you!")
else:
VIPIN YADAV XII B 19
INFORMATICS PRACTICES
print("Invalid choice. Please try again.")
Menuset()
# Run the menu
Menuset()
VIPIN YADAV XII B 20
INFORMATICS PRACTICES
OUTPUT :
VIPIN YADAV XII B 21
INFORMATICS PRACTICES
OUTPUT 1 – Customer Data Input
VIPIN YADAV XII B 22
INFORMATICS PRACTICES
OUTPUT 2 – Ticket Price listing
VIPIN YADAV XII B 23
INFORMATICS PRACTICES
OUTPUT 3 – Ticket Selection
OUTPUT 4 – Ticket Print
VIPIN YADAV XII B 24
INFORMATICS PRACTICES
OUTPUT 5 – To Calculate Luggage Bills
OUTPUT 6 – To Visualize Data
VIPIN YADAV XII B 25
INFORMATICS PRACTICES
VIPIN YADAV XII B 26
INFORMATICS PRACTICES
BIBLIOGRAPHY
1. http://www.google.com/
2. http://en.wikipedia.org
3. Informatics practices with python
by Priti Arora
VIPIN YADAV XII B 27