0% found this document useful (0 votes)
38 views20 pages

Ip Project

Uploaded by

Yuvraj Dhawan
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)
38 views20 pages

Ip Project

Uploaded by

Yuvraj Dhawan
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/ 20

SBIOA PUBLIC SCHOOL

JAIPUR

INFORMATICS PRACTICES
PRACTICAL FILE

CLASS:- XII SCI

PREPARED BY:-
YUVRAJ DHAWAN & SANSKAR
AGARWAL
CERTIFICATE

The project report entitled “RAILWAY RESERVATION SYSTEM”


Submitted by Yuvraj Dhawan and Sanskar Agarwal of class XII sci for
the CBSE Senior Secondary Examination 2019-20, Class XII for
Informatics Practices SBIOA Public School has been examined.

SIGNATURE OF EXAMINER
ACKNOWLEDGEMENT

I would like to express a deep sense of thanks & gratitude to my


Project guide Mr. Kapil Paliwal for guiding me immensely through the
course of the project. He always evinced keen interest in my work. His
constructive advice & constant motivation have been responsible for
the successful completion of this project.
I also thank my parents for their motivation & support. I must thank my
classmates for their timely help & support for completion of this
project.
Last but not the least I would like to thank all those who had helped
directly and indirectly towards the completion of this project.
CONTENTS
___________________________

1. TABLE STRUCTURE
2. PYTHON CODE
5. INPUT/OUTPUT INTERFACE
6. BIBLIOGRAPHY
“RAILWAY RESERVATION SYSTEM”
DBMS: MySQL
Host : localhost
User: root
Password: root
DataBase: RAIL

Table Structure: (Images Bellow)


PYTHON CODE:

import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="ro
ot",database="rail");
mycursor=mydb.cursor()
def railresmenu():
print("--------------------------------------------------------\nRailway
Reservation\n--------------------------------------------------------")
print("1.Train Detail")
print("2.Reservation of Ticket")
print("3.Cancellation of Ticket")
print("4.Display PNR status")
print("5.Passengers Detail")
print("6.Quit")

n=int(input("enter your choice :"))


if(n==1):
traindetail()
elif(n==2):
reservation()
elif(n==3):
cancel()
elif(n==4):
displayPNR()
elif(n==5):
psgdetail()
elif(n==6):
exit(0)
else:
print("________wrong choice________")

def traindetail():
print("--------------------------------------------------------\nTrain Details\
n--------------------------------------------------------")
ch='y'
while (ch=='y'):
l=[]
name=input("enter train name :")
l.append(name)
tnum=int(input("enter train number :"))
l.append(tnum)
ac1=int(input("enter number of AC 1 class seats :"))
l.append(ac1)
ac2=int(input("enter number of AC 2 class seats :"))
l.append(ac2)
ac3=int(input("enter number of AC 3 class seats :"))
l.append(ac3)
slp=int(input("enter number of sleeper class seats :"))
l.append(slp)
train=(l)
sql="insert into traindetail(tname,tnum,ac1,ac2,ac3,slp)values(%s,
%s,%s,%s,%s,%s)"
mycursor.execute(sql,train)
mydb.commit()
print("insertion completed")
print("Do you want to insert more train Detail")
ch=input("enter yes/no")
print('\n')

print("===================================================
================")

railresmenu()

def reservation():
print('--------------------------------------------------------\nWELCOME\nto\
nTRAIN RESERVATION SYSTEM\
n--------------------------------------------------------')
pnr=1024
l1=[]
pname=input("enter passenger name=")
l1.append(pname)
age=input("enter age of passenger =")
l1.append(age)
trainno=input("enter train number")
l1.append(trainno)
np=int(input("Enter number of passanger:"))
l1.append(np)
print("select a class you would like to travel in")
print("1.AC FIRST CLASS")
print("2.AC SECOND CLASS")
print("3.AC THIRD CLASS")
print("4.SLEEPER CLASS")
cp=int(input("Enter your choice:"))
if(cp==1):
amount=np*1000
cls='ac1'
elif(cp==2):
amount=np*800
cls='ac2'
elif(cp==3):
amount=np*500
cls='ac3'
else:
amount=np*350
cls='slp'
l1.append(cls)
print("Total amount to be paid:",amount)
l1.append(amount)
pnr=pnr+1
print("PNR Number:",pnr)
print("status: confirmed")
sts='conf'
l1.append(sts)
l1.append(pnr)
train1=(l1)
sql="insert into
passengers(pname,age,trainno,noofpas,cls,amt,status,pnrno)values(%s,
%s,%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,train1)
mydb.commit()
print("insertion completed")
print("Go back to menu")
print('\n')

print("===================================================
================")

railresmenu()

def cancel():
print("--------------------------------------------------------\nTicket cancel
window\n--------------------------------------------------------")
pnr=input("enter PNR for cancellation of Ticket")
pn=(pnr,)
sql="update passengers set status='deleted' where pnrno=%s"
mycursor.execute(sql,pn)
mydb.commit()
print("Deletion completed")
print("Go back to menu")

print("===================================================
================")

railresmenu()

def displayPNR():
print("--------------------------------------------------------\nPNR Status window\
n--------------------------------------------------------")
pnr=input("enter PNR NUMBER")
pn=(pnr,)
sql="select * from passengers where pnrno=%s"
mycursor.execute(sql,pn)
res=mycursor.fetchall()
print("PNR STATUS are as follows : ")
print("(pname,age,trainno, noofpas,cls,amt,status, pnrno)")
for x in res:
print(x)

print("Go back to menu")


print('\n')

print("===================================================
================")

railresmenu()

def psgdetail():
print("--------------------------------------------------------\nPassengers Detail
Window\n--------------------------------------------------------")
mycursor.execute('select * from passengers')
for i in mycursor:
print(i)
print("Go back to menu")
print('\n')

print("===================================================
================")

railresmenu()
railresmenu()
displayPNR()
cancel()
reservation()
traindetail()
psgdetail()
OUTPUT SCREEN:

🡪 Train detail window


🡪 Reservation window
🡪 Cancellation of ticket window
🡪 Display PNR status window
--🡪 passengers details
BIBLIOGRAPHY

1. Sumita Alora (Python)


2. www.python.com
3. pythontrends.wordpress.com

You might also like