A Project Report
on
Railway Reservation System
Computer Science (083)
2024-25
Submitted By:
Raj Chauhan
Class: XIIth D
Roll No: 31
Uday Gupta
Class:XIID
Roll NO:41
Under the guidance of:
Mrs. Nidhi Shinde
Rosary Senior Secondary School
Radio Colony, Kingsway Camp
Delhi - 110009
1
INDEX
S.No TOPIC Pg No.
1 Name of Project 1
2. Acknowledgement 4
3. Certificate 5
4. Background 6
5. Preface 7
6. System requirements 8
7. Program coding with 9-20
outputs
8. Conclusion & summary 21
9. Bibliography 22
10. End of project 22 -
END
2
RAILWAY
RESERVATION
3
ACKNOWLEDGEMENT
I would like to extend my gratitude to the
Principal Rev. Fr. Savariraj and Headmistress Sr.
Carmen for providing me with all the facility that
was required.
I would also like to express my gratitude to my
guide Mrs. Nidhi Shinde for her able guidance
and support in completing my project.
Last but not the least I would like to thank my
parents and friends who helped me a lot.
…………………………
Signature of Student
Name: RAJ AND UDAY
Class & Section: 12d
Place: Rosary Sr. Sec. School, Delhi
Date: --/--/2024-25
4
CERTIFICATE
This is to certify that the project titled, “ Hospital
Management System” is a piece of work done by RAJ
CHAUHAN ,UDAY GUPTA of class XIIth – D, in
partial fulfillment of CBSE’S AISSCE 2024-25 and
has been carried out under my supervision and
guidance. This report or an identical report on this topic
has not been submitted for any other examination and
does not form a part of any other course undergone by
the candidate.
..............................
Signature of Teacher/Guide
Name: Mrs. Nidhi Shinde
Designation: PGT (Computer Science)
Place: Rosary Sr. Sec. School, Delhi
Date: --/--/2024-25
5
BACKGROUND
It so happened that one day I went to
RAILWAY STATION. I noticed that the
manager was much tensed. On being
enquired by me, he told me that everything in
the RAILWAY STATION was messed up. He
told me that keeping records of the passenger
manually was extremely difficult.
At that time I got the idea of designing handy
and easy to use software so that I could help
the manager. This program provides all
required facilities. It provides the facility to
keep the records of passenger in a much
easier and efficient way. With the help of large
database. So I developed “RAILWAY
RESERVATION”
And it has made the whole work more
systematic and organized
6
PREFACE
As soon as I felt the need of our project, I started
investing the existing manual file management
system so that I could look out for possible
modification. Then I conducted a small interview
with railway manager so that I could get some
possible suggestions. He told us about the
requirement. After that I did on-site observation to
analyse the system in a much better way. Then I
designed the projects per the needs. Then I did
the coding of the software and test it to evaluate
the system’s compliance with its specified
requirements. Lastly I gave him a copy of my
software. The result was satisfactory.
So I replaced the old manual system by this
new computerized system. Now everything is
very well !
7
SYSTEM REQUIREMENT
This software has been designed for public
use and thus has no Additional requirements.
It is portable and very handy too. Also, no
special training is required to use it. Some of
its primary Requirements are:
A PC with 512 MB of memory
(RAM) with CD drive.
Hard Disk with 1 GB space free.
Mouse and Keyboard.
Windows XP with SP2
Software of python
8
Project Coding
RAILWAY RESERVATION:
// coding part paste here
###############################
#create table passengers( pname varchar(100), age
varchar(100), trainno varchar(100), noofpas varchar(100),
cls varchar(100), amt varchar(100), status varchar(100),
pnrno varchar(100) );
#create table traindetail ( tname varchar(100),
tnum varchar(100), ac1 varchar(100), ac2
varchar(100), ac3 varchar(100), slp
varchar(100) ); ###############################
import
mysql.connector
#import MySQLdb
#import os
#import platform
#import pandas as pd
#pnr=1010
mydb=mysql.connector.connect(host="localhost",user="root",
pa sswd="123456",database="rail");
9
#mydb = MySQLdb.connect(host="localhost",
user="root", db="rail")
mycursor=mydb.cursor()
# GET THE LAST PNR NUMBER
sql="select pnrno from passengers order by pnrno desc limit
1;" print(sql)
mycursor.execute(sql)
res=mycursor.fetchall()
pnr=1000;
if len(res)>0:
pnr=int(res[0][0])
print(pnr)
print(res)
def railresmenu():
print("Railway Reservation ")
print("1.Train Detail")
print("2.Reservation of Ticket")
print("3.Cancellation of Ticket")
print("4.Display PNR status")
print("5.Quit")
n=int(input("enter your choice:"))
if(n==1):
10
traindetail()
elif(n==2):
reservation()
elif(n==3):
cancel()
elif(n==4):
displayPNR()
elif(n==5):
exit(0)
else:
print("wrong choice")
def traindetail():
print("Train Details")
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") seats"))
)
seats")
)
11
AC 3 class
l.appe
nd(ac1
)
ac2=int
(input("
enter
numbe
r
of
AC
class
l.appe
nd(ac2
)
ac3=int
(input("
enter
numbe
r
of
12
l.append(ac3)
slp=int(input("enter number of sleeper
seats") class
)
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' *10)
13
print("==========================================
=====
====================")
railresmenu()
def reservation():
global pnr
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:")1.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*80
0 cls='ac2'
elif(cp==3):
amount=np*50
14
0 cls='ac3'
else:
amount=np*35
0 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(pn
r) train1=(l1)
sql="insert into
15
passengers(pname,age,trainno,noofpas,cls,amt,status,pnrno)
values(%s,%s,%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,train
1) mydb.commit()
print("insertion completed")
print("Go back to menu")
print('\n' *10)
print("==========================================
=====
====================")
railresmenu()
railresmenu()
def cancel():
print("Ticket cancel window")
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('\n' *10)
print("==========================================
=====
====================")
railresmenu()
16
railresmenu()
17
def displayPNR():
print("PNR STATUS window")
pnr=input("enter PNR NUMBER")
pn=(pnr,)
sql="select * from passengers where
pnrno=%s" mycursor.execute(sql,pn)
res=mycursor.fetchall()
#mydb.commit()
print("PNR STATUS are as follows : ")
print("(pname,age,trainno,
noofpas,cls,amt,statu
s,
pnrno)"
) for x in res:
print(x)
#print("Deletion completed")
print("Go back to menu")
print('\n' *10)
print("==========================================
=====
====================")
railresmenu()
railresmenu()
railresmenu()
18
OUTPUTS:-
19
20
21
22
23
CONCLUSION AND SUMMARY
The project has been liked by everyone
and has been well appreciated. It has
made the whole process of RAILWAY
MANAGEMENT very organized tidy. I had
tried my level best to make successful and
good software. Also the whole experience
of working on the project and then
implementing it was very exciting and
knowledgeable. It has given me a feeling
of satisfaction and has given me the
confidence of doing some similar things in
future.
24
BIBLOGRAPHY
In making the project I took the help of
following sources of information:
Textbook in PYTHON
Mrs.Nidhi shinde
25