100% found this document useful (1 vote)
2K views

Project Report On: Railway Reservation

The document is a project report on developing a railway reservation system using Python. It includes sections on the objectives, introduction, hardware/software requirements, input/output requirements, flow diagram, working of the project, source code, output screens and conclusion. The project aims to apply programming skills to develop a software that allows users to book and cancel train tickets online through a database-based system using Python and MySQL.

Uploaded by

Ishaan Seth
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
100% found this document useful (1 vote)
2K views

Project Report On: Railway Reservation

The document is a project report on developing a railway reservation system using Python. It includes sections on the objectives, introduction, hardware/software requirements, input/output requirements, flow diagram, working of the project, source code, output screens and conclusion. The project aims to apply programming skills to develop a software that allows users to book and cancel train tickets online through a database-based system using Python and MySQL.

Uploaded by

Ishaan Seth
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

New Horizon Scholars School, Thane

Project Report
On
Railway Reservation

Submitted By
Ahan Halder
XII Science B

Under the Guidance of


Mrs. Subhra Sarkar
Acknowledgement
I would like to express a deep sense of thanks and gratitude to our
Principal and Regional Director Dr. Jyoti Nair and the Vice-Principal
Mrs. Poonam Arora for co-ordination in extending every possible
support for the completion of this project.
I would also like to thank my project guide Mrs. Subhra Sarkar for
guiding me immensely throughout the course of the project. Her
constructive advice and constant motivation have been responsible for
the successful completion of this project.
I also would like to thank my parents and family members for their
motivation and support.
Last but not the least; I would like to thank all my team members and
friends for their timely help and support for compilation of this
project.
Index
S.N
CONTENT PAGE NO Signature
O
1 Objective 1
2. Introduction 2
3. Hardware/Software Requirement 3
4. Input / Output Requirement 4
5. Flow Diagram 5
6. Working Of Project 6
7. Source Code 7
8. Output Screens 12
9. Conclusion 16
10. References and Bibliography 16
Objective
The objective of this project is to let the students apply the
programming knowledge into a real- world situation/problem and
exposed the students how programming skills helps in developing a
good software.

1. Write programs utilizing modern software tools.


2. Apply object-oriented programming principles effectively when
developing small to medium sized projects.
3. Write effective procedural code to solve small to medium sized
problems.
4. Students will demonstrate a breadth of knowledge in computer
science, as exemplified in the areas of systems, theory and
software development.
5. Students will demonstrate the ability to conduct research or
applied Computer Science project, requiring writing and
presentation skills which exemplify scholarly style in computer
science.
Introduction
The railway reservation system is basically a database-based
project done with help of python language. This project is very use
full for the people to book or cancel train tickets by sitting at home
with one cell phone in their hand. This project can be modified for
various reservations. For This Project One has to use the data
management software.
Hardware/Software Requirement
HARDWARE REQUIREMENTS:

I.OPERATING SYSTEM : WINDOWS 7 AND ABOVE


II. PROCESSOR : PENTIUM(ANY) OR AMD
ATHALON(3800+- 4200+
DUAL CORE)
III. MOTHERBOARD : 1.845 OR 915,995 FOR
PENTIUM 0R MSI
K9MM-V VIA
K8M800+8237R PLUS
CHIPSET FOR AMD
ATHALON
IV. RAM : 512MB+
V. Hard disk : SATA 40 GB OR ABOVE
VI. CD/DVD r/w multi drive combo: (If back up required)
VII. FLOPPY DRIVE 1.44 MB : (If Backup required)
VIII. MONITOR 14.1 or 15 -17 inch
IX. Key board and mouse
X. Printer : (if print is required – [Hard copy])

SOFTWARE REQUIREMENTS:

 Windows OS
 Python
 mysql connector module
Input / Output Requirement

INPUT REQUIREMENTS:
• An account in the system
• If account does not exist, you can create your account
• Credit/debit card details for transaction if a ticket is being
booked.

OUTPUT REQUIREMENTS:
• Customers can search trainees based on their requirements.
• Staff able to edit customers booking information
• Customers can write reviews
• Customers able to check their booking status from their
individual account.
• Customers can book online and pay with credit or debit card.
Flow Diagram
Working of Project
The basic working of this Reservation system is as follows:
1. If a passenger wants to reserve ticket(s), firstly, he/she has to log
in to the Railway system with valid credentials. Then, the
passenger has to provide his/her details with along with all the
necessary details of the journey and the class type of the
required ticket(s).
2. There are different elements in the structure, two strings one for
taking passenger name and gender and one integer for taking
passenger age. And we wil use a for loop to take in the details of
multiple passengers.
3. The Railway Reservation System will provide the available
Train-list, and Seat-availability, via-details.
4. To book a ticket passengers can pay through online/offline
mode. After successful payment of the ticket fare, the System
will generate the ticket and PNR number will be given to the
passenger
5. The Passenger can check PNR status (confirmed, RAC, waiting
list) by entering the PNR no. into the system.
6. The Reservation system stores all train details, fare details (by
zone, class, and date wise), PNR no, date of trains, etc.
7. The ticket value will be evaluated. The system will ask to enter
the seat choice by showing the seat matrix. At last, a receipt will
be generated on the screen.
Source Code
def connection():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railway'
)
if mycon.is_connected():
print("successfully connected")
connection()

def Create_Database_Railway():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager')
cursor=mycon.cursor()
mycon.autocommit=True
s1="create database railway"
cursor.execute(s1)
Create_Database_Railway()

def table_creation_railway():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
s1="create table railway(name varchar(100),phno varchar(15) primary key,age int(4),gender
varchar(50),from_f varchar(100),to_t varchar(100),date_d varchar(20))"
cursor.execute(s1)
table_creation_railway()

def table_creation_user_accounts():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
s1="create table user_accounts(fname varchar(100),lname varchar(100),user_name
varchar(100) ,password varchar(100) primary key, phno varchar(15),gender varchar(50),dob
varchar(50),age varchar(4))"
cursor.execute(s1)
table_creation_user_accounts()

def menu():
print('1.YES')
print('2.NO')
ch=int(input('DO YOU WANT TO CONTINUE OR NOT:'))
while ch==1:
print('WELECOME TO ONLINE RAILWAY RESERVATION SYSTEM')
print('1.SIGN IN')
print('2.SIGN UP')
print('3.DELETE ACCOUNT')
print('4.EXIT')
ch1=int(input('ENTER YOUR CHOICE:'))
if ch1==1:
a=checking()
if a==True:
print('WELCOME')
main()
else:

continue
elif ch1==2:
a=checking_1()
if a==True:
main()
else:
print('PASSWORD ALREADY EXISTS')
continue

elif ch1==3:
c=checking_2()
if c==True:

print('ACCOUNT DELETED')
continue
else:
print('YOUR PASSWAORD OR USER_NAME IS INCORRECT')
continue
elif ch1==4:
print('THANK YOU')
break
else:
print('ERROR 404:PAGE NOT FOUND')
break
def main():
print('1.yes')
print('2.no')
c=int(input("do you want to continue or not:"))
while (c==1):
print(' 1.TICKET BOOKING',"\n", '2.TICKET CHECKING',"\n",'3.TICKET CANCELLING',"\
n",'4.ACCOUNT DETAILS',"\n",'5.LOG OUT')
ch=int(input('enter your choice:'))
if ch==1:
ticket_booking()
elif ch==2:
ticket_checking()
elif ch==3:
ticket_cancelling()
elif ch==4:
checking_3()

elif ch==5:
print('THANK YOU')
break
else:
print('WRONG INPUT')
else:
print('ERROR 404: ERROR PAGE NOT FOUND')
def ticket_booking():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railway'
)
cursor=mycon.cursor()
mycon.autocommit=True
nm=input('enter your name:')
phno=input('enter your phone number:')
age=int(input('enter your age:'))
print(' M=MALE','\n','F=FEMALE','\n','N=NOT TO MENTION')
gender=input('enter your gender:')
Gender=gender.upper()
fr=input('enter your starting point:')
to=input('enter your destination:')
date1=input('enter date(dd):')
date2=input('enter month(mm):')
date3=input('enter year(yyyy):')
date=date1+"/"+date2+"/"+date3
a={'M':'MALE','F':'FEMALE','N':'NOT TO MENTION'}
v=a[Gender]
s1="insert into railway values('{}',{},{},'{}','{}','{}','{}')".format(nm,phno,age,v,fr,to,date)
cursor.execute(s1)
print('BOOKED SUCCESSFULLY')
def ticket_checking():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
print('1.yes')
print('2.no')
ch=int(input("do you want to continue or not:"))

if ch==1:
phno=int(input('enter your phnone number:'))
try:
s1="select * from railway where phno=phno"
cursor.execute(s1)
data=cursor.fetchall()[0]
Data=list(data)
a=['NAME','PHONE NUMBER','AGE','GENDER','STARTING POINT','DESTINATION','DATE',]
print(a[0],'::::',Data[0].upper())
print(a[1],'::::',Data[1])
print(a[2],'::::',Data[2])
print(a[3],'::::',Data[3].upper())
print(a[4],'::::',Data[4].upper())
print(a[5],'::::',Data[5].upper())
print(a[6],'::::',Data[6])
except:
print('TICKET DOES NOT EXISTS')
elif ch==2:
print('THANK YOU')
else:
print('ERROR 404:PAGE NOT FOUND')

def ticket_cancelling():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
print('1.yes')
print('2.no')
ch=int(input("do you want to continue or not:"))
if ch==1:
phno=input('enter your phone number:')
s1="delete from railway where phno=phno"
cursor.execute(s1)
print('TICKET CANCELLED')
elif ch==2:
print('THANK YOU')
else:
print('ERROR 404:PAGE NOT FOUND')

def checking_2():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
a=input('USER NAME:')
b=input('PASS WORD:')
try:
s1="select user_name from user_accounts where password='{}'".format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
print('IS THIS YOUR ACCOUNT')
s1="select user_name from user_accounts where password='{}'".format(b)
c1="select fname,lname from user_accounts where password='{}'".format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0]
data1=list(data1)
data1=data1[0]+' '+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
x=['FIRST NAME','LAST NAME','PHONE NUMBER','GENDER','DATE OF BIRTH','AGE']
s1="select fname,lname,phno,gender,dob,age from user_accounts where
password='{}'".format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
print(x[0],':::',data[0])
print(x[1],':::',data[1])
print(x[2],':::',data[2])
print(x[3],':::',data[3])
print(x[4],':::',data[4])
print(x[5],':::',data[5])
print('1.yes')
print('2.no')
vi=int(input('enter your choice:'))
if vi==1:
b1="delete from user_accounts where password = '{}'".format(b)
cursor.execute(b1)
return True
elif vi==2:
print('SORRY,RETRY')
else:
print('ERROR 404:PAGE NOT FOUND')
else:
return False
except:
print('ACCOUNT DOES NOT EXIST')

def checking_1():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
f=input("FIRST NAME:")
l=input("LAST NAME:")
n=f+" "+l
a=input('USER NAME:')
b=input('PASS WORD:')
c=input('RE-ENTER YOUR PASS WORD:')
ph=input("PHONE NUMBER:")
print(' M=MALE','\n','F=FEMALE','\n','N=NOT TO MENTION')
gen=input('ENTER YOUR GENDER:')
print("ENTER YOR DATE OF BIRTH")
d=input("DD:")
o=input("MM:")
p=input("YYYY:")
dob=d+'/'+o+'/'+p
age=input('YOUR AGE:')
v={'m':'MALE','f':'FEMALE','n':'NOT TO MENTION'}
if b==c:
try:
c1="insert into user_accounts
values('{}','{}','{}','{}','{}','{}','{}','{}')".format(f,l,a,b,ph,v[gen],dob,age)
cursor.execute(c1)
print('WELCOME',f,' ',l)
return True
except:
print('PASSWORD ALREADY EXISTS')
return False
else:
print('BOTH PASSWORDS ARE NOT MATCHING')

def checking():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
a=input('USER NAME:')
b=input('PASS WORD:')
try:
s1="select user_name from user_accounts where password='{}'".format(b)
c1="select fname,lname from user_accounts where password='{}'".format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0]

data1=list(data1)
data1=data1[0]+' '+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)[0]
if data==a:
print(' HII ',data1)
return True
else:
return False
except:
print('ACCOUNT DOES NOT EXIST')

def checking_3():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root',passwd='manager',database='railwa
y')
cursor=mycon.cursor()
mycon.autocommit=True
a=input('USER NAME:')
b=input('PASS WORD:')
try:
s1="select user_name from user_accounts where password='{}'".format(b)
c1="select fname,lname from user_accounts where password='{}'".format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0]
data1=list(data1)
data1=data1[0]+' '+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
x=['FIRST NAME','LAST NAME','PHONE NUMBER','GENDER','DATE OF BIRTH','AGE']
s1="select fname,lname,phno,gender,dob,age from user_accounts where
password='{}'".format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
print(x[0],':::',data[0])
print(x[1],':::',data[1])
print(x[2],':::',data[2])
print(x[3],':::',data[3])
print(x[4],':::',data[4])
print(x[5],':::',data[5])
else:
return False
except:
print('ACCOUNT DOES NOT EXIST')
menu()
Output Screens
CHOICE WINDOW:

IF CHOICE IS 1(LOGIN WINDOW):

IF CHOICE IS 2 (SIGN UP WINDOW):


IF CHOICE IS 3(DELETE ACCOUNT):

IF CHOICE IS 4(EXIT):

IF CHOICE IS 5 OR MORE:

SECOND CHOICE LIST AFTER LOGIN:

IF CHOICE IS 1(TICKET BOOKING):


IF CHOICE IS 2(TICKET CHECKING):

IF CHOICE IS 3(TICKET CANCELLING):

IF CHOICE IS 4(ACCOUNT DETAILS):


IF CHOICE IS 5(LOG OUT):

IF CHOICE IS 5 OR MORE:
Conclusion
One has to use the data management software. Software has been an
ascent in atomization various organisations. Many software products
working are now in markets, which have helped in making the
organizations work easier and efficiently. Data management initially
had to maintain a lot of ledgers and a lot of paper work has to be done
but now software product on this organization has made their work
faster and easier. Now only this software has to be loaded on the
computer and work can be done.

This prevents a lot of time and money. The work becomes fully
automated and any information regarding the organization can be
obtained by clicking the button. Moreover, now it’s an age of
computers of and automating such an organization gives the better
look.

References and Bibliography


• Computer science With Python - Class XII, By: Sumita Arora
• Website: https://www.w3resource.com

You might also like