import mysql.
connector
import sys
mydb=mysql.connector.connect(host="localhost",user="root",passwd="surya",database="air_ticket",ch
arset="utf8")
mycursor=mydb.cursor()
print("\t\t ______________________________________________________________________")
print("\t\t|______________________________________________________________________|")
print("\t\t|-------->>>> TOPIC OF PROJECT : AIRLINE MANAGEMENT SYSTEM <<<<--------|")
print("\t\t ______________________________________________________________________")
print("\t\t|------------------------->>>> CLASS : XII <<<<------------------------|")
print("\t\t|______________________________________________________________________|")
def registercust():
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:')
L.append(source)
destination=input('Enter destination:')
L.append(destination)
cust=(L)
sql='insert into cdata(custno,custname,addr,jrdate,source,destination) values(%s,%s,%s,%s,%s,%s)'
mycursor.execute(sql,cust)
mydb.commit()
def ticketprice():
L=[]
cno=int(input('Enter custoner no='))
L.append(cno)
print('We have the following options 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)
sql="insert into tkt (custno,tkt_tot,lug_tot,g_tot) values (%s,%s,%s,%s)"
mycursor.execute(sql,tkt)
mydb.commit()
def dis():
custno=int(input("Enter the customer number whose bill to be viewed : "))
sql="Select cdata.custno, cdata.custname,
cdata.addr,cdata.source,cdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot from cdata INNER JOIN tkt ON
cdata.custno=tkt.custno and tkt.custno = %s"
rl=(custno,)
mycursor.execute(sql,rl)
res=mycursor.fetchall()
for x in res:
print(x)
def dispall():
sql="Select cdata.custno, cdata.custname,
cdata.addr,cdata.source,cdata.destination,tkt.tkt_tot,tkt.lug_tot, g_tot from cdata INNER JOIN tkt ON
cdata.custno=tkt.custno"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The Customer details are as follows : ")
for x in res:
print(x)
def Menuset():
print('Enter 1: To enter customer data.')
print('Enter 2: For ticketamount.')
print('Enter 3: Display customerwise Details.')
print('Enter 4: Display All Details.')
print('Enter 5: Exit')
userinput=int(input('Enter your choice:'))
if userinput==1:
registercust()
elif userinput==2:
ticketprice()
elif userinput==3:
dis()
elif userinput==4:
dispall()
elif userinput==5:
print("Thank you for vising us")
sys.exit(0)
else:
print('Enter correct choice.')
Menuset()
def runagain():
runagn=input('\nWant to run again? y/n:')
while runagn=='y':
Menuset()
runagn=input('\nWant to run again? y/n:')
runagain()