0% found this document useful (0 votes)
15 views5 pages

Airline Code

The document is a Python script that connects to a MySQL database for an airline management system. It includes functionalities for managing food items, luggage, flight details, and customer bookings, allowing both admin and user interactions. The script defines various functions for adding, updating, and deleting records in the database, as well as displaying available flights and food items.

Uploaded by

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

Airline Code

The document is a Python script that connects to a MySQL database for an airline management system. It includes functionalities for managing food items, luggage, flight details, and customer bookings, allowing both admin and user interactions. The script defines various functions for adding, updating, and deleting records in the database, as well as displaying available flights and food items.

Uploaded by

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

import mysql.

connector
obj=mysql.connector.connect(host="localhost",user="root",passwd="root",charset="utf
8")
mycursor=obj.cursor()
mycursor.execute("Use Airline_Management")
mycursor.execute("create table if not exists food_items(sl_no int(4)auto_increment
primary key,food_name varchar(40)not null,price int(4) not null)")
mycursor.execute("Create table if not exists luggage(Luggage_id int (4)
auto_increment primary key,weight int(3) not null,price int(4) not null)")
mycursor.execute("Create table if not exists class_details(class_id int(4)
auto_increment primary key,Class_type varchar(40) not null,price int(10) not
null)")
mycursor.execute("create table if not exists flight_details(flight_id varchar(50)
auto_increment primary key,flight_name
varchar(40),departure(40),destination(40),day varchar(40),f_time time,business
int,Economic int)")
mycursor.execute("create table if not exists Customer_details(Cus_id int(10)
auto_increment primary key,Cus_name varchar(50),Mob_no bigint,fl_id int,fl_name
varchar(50),Class varchar(25),dept varchar(25),dest varchar(25),day
varchar(25),fl_time time,price int)")
obj.commit()
def luggage():
print("what do you want to do?")
print("1. add luggage")
print("2. delete luggage")
x=int(input("enter your choice: "))
if x==1:
lname=input("enter luggage type: ")
mycursor.execute("insert into luggage
values({},'{}'".format('null',lname))
elif x==2:
lid=int(input("enter your luggage id: "))
mycursor.execute("delete from luggage where luggage_id={}".format(lid))
else:
print(" **************** PLEASE ENTER A VALID OPTION
**************************** ")
food()
obj.commit()
def food():
print("what do you want to do?")
print("1. add new items")
print("2. update price")
print("3. delete items")
x=int(input("enter your choice: "))
if x==1:
fname=input("enter food name: ")
fprice=int(input("enter food price: "))
mycursor.execute("insert into food_items values({},'{}',
{}".format('null',fname,fprice))
elif x==2:
fid=int(input("enter food id: "))
fprice=int(input("enter new price: "))
mycursor.execute("update food_items set price={} where
food_id={}".format(fid,fprice))
elif x==3:
fid=int(input("enter food id: "))
mycursor.execute("delete from food_items where where
food_id={}".format(fid))
else:
print(" **************** PLEASE ENTER A VALID OPTION
**************************** ")
food()
obj.commit()
def classtype():
print("what do you want to do? ")
print("1. change the classtype name")
print("2. change the price of classtype")
x=int(input("enter your choice: "))
if x==1:
oname=input("enter old name: ")
nname=input("enter new name: ")
mycursor.execute("update classtype set'{}'='{}'".format(oname,nname))
def fooditems():
print(" ")
print(" ")
print(" THE AVAILABLE FOODS ARE: ")
print(" ")
print(" ")
mycursor.execute("select * from food_items")
x=mycursor.fetchall()
for i in x:
print(" FOOD ID: ",i[0])
print(" FOOD Name: ",i[1])
print(" PRICE: ",i[2])

print("____________________________________________________________________________
______________")

def admin1():
print("************WHAT'S YOUR TODAYS GOAL?****************")
print("1. update details")
print("2. show details")
print("3. job approval")
x=int(input("select your choice: "))
while True:
if x==1:
print("1. classtype")
print("2. food")
print("3. luggage")
x1=int(input("enter your choice"))
if x1==1:
classtype()
elif x1==2:
food()
elif x1==3:
luggage()
else:
print(" ********************** PLEASE ENTER A VALID OPTION
******************************** ")
admin1()

elif x==2:
print("1. classtype")
print("2. food")
print("3. luggage")
print("4. records")
y=int(input("from which table: "))
if y==1:
mycursor.execute("select * from classtype")
else:
mycursor.execute("select * from customer_details")
z=mycursor.fetchall()
for i in z:
print(i)
print("**************** THESE ABOVE PEOPLE HAVE BOOKED TICKET
*****************************")
break
def admin():
while True:
sec=input("enter the password: ")
if sec=="admin":
admin1()
else:
print("************YOUR PASSWORD IS INCORRECT*********")
print("***********PLEASE TRY AGAIN*****************")
admin()
break
def record():
cid=int(input("enter your customer id: "))
mycursor.execute(" select * from customer_details where
cus_id={}".format(cid))
d=mycursor.fetchall()
print("YOUR DETAILS ARE HERE...........")
print("customer id: ",d[0])
print("name: ",d[1])
print("mobile number: ",d[2])
print("flight id: ",d[3])
print("flight name",d[4])
print("classtype: ",d[5])
print("departure place",d[6])
print("destination",d[7])
print("flight day: ",d[8])
print("flight time: ",d[9])
print("price of ticket: ",d[10])
print("date of booking ticket: ",d[11])
def ticketbooking():
cname=input("enter your name: ")
cmob=int(input("enter your mobileno: "))
if cmob==0000000000:
print(" MOBILE NUMBER CANT BE NULL ")
ticketbooking()
fid=int(input("enter flight id: "))
fcl=input("enter your class: ")
fname=input("enter your flight name")
dept=input("enter departure place: ")
dest=input("enter destination: ")
fday=input("enter flight day: ")
ftime=input("enter flight time: ")
fprice=input("enter ticket rate: ")
mycursor.execute("insert into customer_details values({},'{}',{},
{},'{}','{}','{}','{}','{}','{}',
{}".format('null',cname,cmob,fid,fname,fcl,dept,dest,fday,ftime,"curdate()"))
obj.commit()
def flightavailable():
print(" ")
print(" ")
print(" THE AVAILABLE FLIGHTS ARE: ")
print(" ")
print(" ")
mycursor.execute("select * from flight_details")
x=mycursor.fetchall()
for i in x:
print(" ")
print(" Flight ID: ",i[0])
print(" Flight Name: ",i[1])
print(" departure: ",i[2])
print(" Destination: ",i[3])
print(" Take off Day: ",i[4])
print(" Take off time : ",i[5])
print(" bussiness : ",i[6])
print(" middle : ",i[7])
print(" economic : ",i[8])

print("____________________________________________________________________________
______________")

def user():
while True:
print("************** MAY I HELP YOU? *****************")
print("1. flight details")
print("2. food details")
print("3. book ticket")
print("4. my details")
print("5. exit")
x=int(input("enter your choice: "))
if x==1:
flightavailable()
elif x==2:
fooditems()
elif x==3:
ticketbooking()
elif x==4:
records()
else:
print("************ PLEASE CHOOSE A CORRECT OPTION ************")
break

def menu1():

print("1. admin")
print("2. user")
print("3. exit")
x=int(input("choose a option: "))
while True:
if x==1:
admin()
elif x==2:
user()
else:
print("************PLEASE CHOOSE A CORRECT
OPTION******************")
menu1()
break
print("****************** WELCOME TO PARGS AIRLINES **********************")
print("************ MAKE YOUR JOURNEY SUCCESS WITH US! *****************")
menu1()

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