CSINVST
CSINVST
By Pranav S
Kendriya Vidyalaya
(Affiliated to CBSE)
CECRI Campus
FEBRUARY 2024
DECLARATION
I hereby declare that the investigatory project entitled Train Ticket Reservation
System, submitted in partial fulfillment of the requirement of CBSE SSC 2023-24,
is a record of the work of my very own carried out by me under the supervision and
guidance of Ms. V. N. Shobana, PGT Computer Science, Kendriya Vidyalaya
Karaikudi. The source of information has been derived from the suitable literature
and appropriate credit has been given to the original sources in places where it is
due. This work has not been submitted as part of any project in other institutions or
competitions.
S. PRANAV
XII-A
It is with thorough revisal that I certify that the declaration made by the
aforementioned candidate is absolutely true.
i
Kendriya Vidyalaya Karaikudi
Affiliated to CBSE
BONAFIDE CERTIFICATE
This is to certify that the project entitled Train Ticket Reservation System
is a bonafide record of work done by S. Pranav, studying in class XII-A of register
number:
during the period 2023-2024 of his study under the guidance of Ms. V.N. Shobana,
PGT Computer Science, towards the partial fulfillment of the requirement for the
CBSE SSC.
Teacher-in-charge
Principal
ii
ABSTRACT
iii
ACKNOWLEDGEMENT
I’d like to take this wonderful moment to express my heartfelt gratitude to everyone at
Kendriya Vidyalaya Karaikudi for making it possible to complete this investigatory project.
I am highly indebted to Mr. Nand Lal Jangid, Principal of this most esteemed institution
for his constant support, providing me with a scientific and conductive atmosphere that
helped me finish this project on time.
A self-made gratitude from my heart to Ms. V.N. Shobana, PGT Computer Science for her
valuable support, motivation and guidance.
A special thanks to my parents and my sister for their constant support, encouragement,
and for extending a shoulder to keep me motivated till the end by being my biggest
cheerleader.
Last but not the least, my bowings to the almighty for showering me with the strength,
confidence and ideas for completing this project.
S. Pranav
XII-A
iv
TABLE OF CONTENTS
4.1 The Man, the Myth, and the Legend: Guido van 10
Rossum
1
CHAPTER 1
INTRODUCTION
In the emerging digital world, the importance of programming, coding and usage of
computing systems has increased. We tend to apply these concepts to our everyday
important works. We use computing and coding in ticket booking systems, attendance
sheets, maintain lists in institutions and further usage in simple institutions such as stores,
shops thus maintaining record of everything. But in most of situations we target local file
system to develop, which isn’t feasible since it is only accessible locally and not available
globally. This project aims to apply computing and coding to one Train ticket reservation
system (TTRS). Currently, TTRS is widely used in stations in India but does not allow an
easy access for individuals to book the train tickets, causing them to wait in large queues.
This also leads to unnecessary delay. Plus, allowance of individuals to book tickets on the
go is one of the important aspects of this project.
The data redundancy caused due to local file system is a means to an end and
unnecessary complications. Complications which include the following scenarios:
2
Due to these many complications with file system, we tend to use database model,
which allows a secure pathway to access data remotely anywhere in any station. This
project aims to integrate SQL- Structured query language with Python to provide a user-
friendly access to whatever the passenger or an administrator wishes.
i) To book a ticket from a given station for trains stopping at that station.
ii) To allow passengers to book and cancel a ticket.
iii) To allow passengers to modify an existing ticket with the help of a station
administrator.
iv) To allow passengers to look up to running status and arrival of trains to that
particular station.
v) To allow passengers to get a copy of their ticket while travelling, along with an
opportunity for the passengers to look up to their ticket status.
vi) To allow station administrators to keep track of all passenger booking details to
monitor unusual activities.
vii) To prevent passengers from travelling without ticket.
This project aims to help railways become profitable and sustainable as given in the
above goals to be achieved. This project also aims for TTRS in becoming an important
vendor for Railways. Progressing through working about sustainability not just for the
Railways, the project hopes to make the system a tool that’d transform railway travels a
piece of cake. Consequently, the project couples the key ideas of Python with SQL by
employing integration through MySQL. With this, the project hopes to allow passengers
look up their details using TTRS, both in the online and the offline mode by employing
DBMS and file system (local) methods respectively.
3
LITERATURE SURVEY
4
CHAPTER 2
LITERATURE SURVEY
Wang Zongjiang (2012) presented a method that entwines the advantages of rough
sets and prisoner’s reform to define rule usefulness, a terminology that’d help define useful
rules to help combat the disproportionation in the huge customer base the railway sector of
China entertains against the tedious process of buying train tickets due to fewer e-
commerce sites that present train tickets to acquire. The proposal involved a three-layer
structure, namely, the database layer, the application services layer, and the user interface
layer for carrying out services like holding data, registering user information, and setting
up execution on a remote computer. The system built also employed various functions
that’d help carry out booking, registration, cancellation, searching, and refunding of train
tickets. Upon careful developments, the system was structured into three layers, namely
data access layer, business logic layer, and business exterior layer for trial run in the market
to mark its commercial launch.
5
Peddy Oliva Joicy et al. (2021) constructed a system that allowed the enquiry of
necessary details to make the travel process through train comfortable. Depending on the
source of destination, cancellation of tickets, enquiry about the status of book tickets, and
real-time updates about their chosen train’s running status particularly in times of distress,
the system utilizes a data base to store the records required and the notes about the trains,
their destinations, and the passengers. With the design and implementation of such a
system, the authors hope to offer a secure, error-free, reliable, and swift management to the
society of users who wish to have a train journey to remember, continuing to have a passion
for train travelling, but have been restrained to do so owing to the hassles involved.
6
SYSTEM
CONFIGURATION
7
CHAPTER 3
SYSTEM CONFIGURATION
i. HARDWARE SPECIFICATION
8
SOFTWARE
OVERVIEW
9
CHAPTER 4
SOFTWARE OVERVIEW
I. PYTHON
A very popular programming choice in the 21st century owing to its “simple-to-
use, easy-to-understand, and piece-of-cake-to-implement” quality, Python is a
widely employed, interpreted, object-oriented, cool, and high-level
programming language that rides on dynamic semantics finding usability in
general-purpose programming.
Figure 4.1: The Man, the Myth, and the Legend: Guido van Rossum
Conceived in the 1980s by Guidon van Rossum as the potential successor with
exception handling capabilities to the ABC Programming Language at Centrum
Wiskunde and Informatica, Netherlands, Python was introduced as the newest
progeny in the programming world in February 20, 1991. Despite its references
to the well-known reptile, python, the name of the programming language
10
actually traces its roots back to an old BBC comedy sketch series called Monty
Python’s Flying Circus.
People use python every day on a walk-in basis without realizing it, and the
community that python supports is always happy to help when a programmer
knocks on their doors. Plus, it is easy to learn, faster to start programming, simple
for crafting new software, and as easy as ABC to employ and deploy the codes
penned owing to its free use. Showing roads to many programmers to find scopes
in several industries, Python has always offered space for a programmer to get
ideas to learn from and implement, finding application in data analytics,
DevOps, Machine Learning, Web Development, and Testing.
For the sake of the project, a Python IDLE of version 3.12 is used to connect
with MySQL databases for the purpose of implementation of the TTRS.
11
II. MySQL
Tracing its name back as the coupling of its founder, Michael’s daughter’s name,
“My”, and its application as a structured query language, MySQL is written in
C and C++. The dolphin embracing the MySQL logo is christened Sakila by
Ambrose Twebaze, an open-source software developer. Working in a client-
server interface composing of a multithreaded SQL server supporting several
back ends, client programs and libraries, administrative tools, and a wide range
12
of APIs, MySQL allows a user application to get a smaller, swifter, and simple
to manage stand-alone product. Its reliability, scalability, flexibility, excellent
performance, and high availability is taken leverage of in this project. The
system studied employs MySQL version 8.0.32 and utilizes a MySQL command
line client and MySQL Workbench CE for the purpose of building a DBMS that
stores the required data for implementation of an efficiently functioning TTRS.
13
SYSTEM
SPECIFICATION
14
CHAPTER 5
SYSTEM SPECIFICATION
15
SYSTEM STUDY
16
CHAPTER 6
SYSTEM STUDY
17
not have a high demand on the available technical resources. This might lead
to a high demand resourcing directed towards the client.
Conclusion: Upon analysis, the developed system was found to be
consumer friendly, for minimal requirements were only necessary to
implement this system.
18
SYSTEM
ARCHITECTURE
19
CHAPTER 7
SYSTEM ARCHITECTURE
The system constructed for the purpose of execution of the goals of the project employs a
combination of MySQL and Python integrated into a TTRS app that accepts input
according to user requirements. With this, the app takes in details regarding booking of a
new ticket and cancellation of an existing ticket and returns status of a train that is running
depending upon the time given and passenger status, like whether a booked ticket is under
the status pending confirmation (RAC) or confirmed booking.
20
Fig 6.2: System Flow (Admin)
The admin, on the other, can access the user details and modify train status by logging into
the app with administration privileges and get the app to send the modified details to the
user as a notification or as an SMS.
System Algorithm
1. Start.
2. Enter into the TTRS portal.
3. Choose the appropriate block depending upon whether you are planning to check
your reservation status or would like to book a ticket.
4. If you’d like to book a ticket, enter the necessary details relevant to the query as
prompted, like your name, the destination, and the point from which you’d like to
embark on the journey.
21
5. If you’d like to cancel a ticket, mention the date you booked as the query to let the
system fetch the necessary details from the database to proceed with the
cancellation.
6. If you’d like to check if trains are running late or on time, provide the details as
required to let the system fetch the results for you.
7. If you are an admin, repeat steps 2 and 3 and allow the system to fetch the relevant
element from the attribute/tuple to modify the desired details.
8. Fire an SMS once booking, cancellation, or modification of passenger status is done.
9. Stop.
System Flowchart
Y N
22
23
System Code
24
==============================================================
===")
print('')
while True:
print("Processes")
print("_________")
print("")
print("Enter GBR0 to exit")
print("Enter GBR1 to get status of Passenger Ticket and other related status")
print("Enter GBR2 to get status of train")
print("Enter GBR3 to modify existing passenger details (RA)")
print("Enter GBR4 to book a new ticket")
print("")
x= input("Enter your choice: ")
if x.upper()=="GBR0":
break
if x.upper()=='GBR1':
while True:
print("")
print("Enter G0 to exit this section")
print("Enter G1 to get Pasenger Ticket Status")
print("Enter G2 to get full passenger Ticket")
print('')
a= input("Enter your choice: ")
if a.upper()=='G1':
y= int(input("Enter Passenger ID: "))
cur.execute("select status from b1status where PID="+str(y))
z= cur.fetchone()
25
print('''Guidelines for Ticket status:
1. W/L- Waiting list
2. C- Confirmed
3. N/C- Not Confirmed''', sep='')
print("Note: N/C and W/L are different. For further clarification enter Y in Unit
U1")
print("=========================================================
=====================")
print("Status of your ticket: ")
print(z[0])
print("=========================================================
======================")
v= input("Unit U1: Do you want any futher clarifications? (Y/N): ")
if v.upper()=='Y':
print("")
print("Clarification Regarding W/L and N/C")
print("")
print("---W/L means you have booked your ticket completely and requires
status confirmation from higher officials")
print("---N/C means your ticket booking has been incomplete. Contact your
train operator to get it confirmed")
print("")
if a.upper()=='G0':
break
if a.upper()=='G2':
io= [0, 125]
26
c= int(input("Enter administator key if you are an admin. If not enter 0: "))
if c==0:
print("")
m= int(input("Enter Passenger ID: "))
cur.execute("select * from b1status where PID="+str(m))
b= cur.fetchone()
print("")
print("Passenger ID \t", '{:>18}'.format("Passenger Name"),
'{:>28}'.format("Destination"), '{:>20}'.format("Ticket Status"), '{:>15}'.format("Train
No"))
print("=========================================================
==============================================================
===========================")
print(b[0], "\t", '{:>25}'.format(b[1]), '{:>30}'.format(b[2]),
'{:>15}'.format(b[3]), '{:>15}'.format(b[4]))
if c==125:
print("")
cur.execute("select * from b1status")
f= cur.fetchall()
print("Passenger ID \t", '{:>18}'.format("Passenger Name"),
'{:>28}'.format("Destination"), '{:>20}'.format("Ticket Status"), '{:>15}'.format("Train
No"))
print("=========================================================
==============================================================
===========================")
for i in f:
27
print(i[0], "\t", '{:>25}'.format(i[1]), '{:>30}'.format(i[2]),
'{:>15}'.format(i[3]), '{:>15}'.format(i[4]))
print("=========================================================
==============================================================
===========================")
if c not in io:
print('')
print("ERROR: Please Re enter your value")
if x.upper()=="GBR2":
while True:
print('')
print("Enter 0 to exit this section")
print("Enter 1 to get specific train running status")
print("Enter 2 to get all trains running status")
print("")
d= int(input("Enter your choice: "))
if d==0:
break
if d==1:
y= input("Please enter your train number: ")
cur.execute("select * from b2status where Tno="+str(y))
har= cur.fetchone()
if har==None:
print('')
print("The train of given train number does not pass through this station.
Please re enter the train no")
else:
28
print("Train No. \t", '{:>18}'.format("Source of Origin"),
'{:>28}'.format("Destination"), '{:>35}'.format("Scheduled Arriving Time"),
'{:>28}'.format("Scheduled departure Time"), '{:>26}'.format("Ariving status"))
print("=========================================================
==============================================================
========================================")
print(har[0], "\t", '{:>25}'.format(har[1]), '{:>30}'.format(har[2]),
'{:>23}'.format(har[6]), '{:>25}'.format(har[4]), '{:>36}'.format(har[3]))
if d==2:
cur.execute("select * from b2status")
h2= cur.fetchall()
print("Train No. \t", '{:>18}'.format("Source of Origin"),
'{:>28}'.format("Destination"), '{:>35}'.format("Scheduled Arriving Time"),
'{:>28}'.format("Scheduled departure Time"), '{:>26}'.format("Ariving status"))
print("=========================================================
==============================================================
===============================================")
for j in h2:
print(j[0], "\t", '{:>25}'.format(j[1]), '{:>30}'.format(j[2]),
'{:>23}'.format(j[6]), '{:>25}'.format(j[4]), '{:>36}'.format(j[3]))
print("=========================================================
==============================================================
===============================================")
if x.upper()=='GBR3':
print('')
29
print('''CAUTION:
---This section requires the prescence of an administrator
---Anyone who tampers with details of passenger details shall be detained, and a
penalty of more than 1500 pounds is expected to be paid henceforth''')
print('')
k= int(input("Enter Administrator password to continue further: "))
if k==125:
while True:
print('')
print("Enter F1 to exit this section")
print("Enter F2 to modify existing passenger details")
print('')
g= input("Enter your choice: ")
print('')
if g.upper()=='F1':
break
if g.upper()=='F2':
g1= int(input("Enter Person Id: "))
print('')
cur.execute("select * from b1status where PID="+str(g1))
hj= cur.fetchone()
if hj==None:
print("The given passenger number doesn't exist. Please try again")
else:
fg= input("Enter new destination location: ")
cur.execute("select * from b2status where Destination in
(\"{}\")".format(fg))
hj= cur.fetchall()
30
if len(hj)==0:
print('')
print("Please re enter the destination for the trains passing through this
station")
else:
print('')
print("Available Trains and Timings")
print('')
print("Train NO.", '\t', '{:>9}'.format("Timings"))
print("=============================")
for ft in hj:
if ft[5]>0:
print(ft[0], '\t', '{:>18}'.format(ft[4]))
print('')
hg= int(input("Enter suitable train no. from the above list as per
timings: "))
cur.execute("update b1status set Dest= (\"{}\") where PID=
(\"{}\")".format(fg, g1))
cur.execute("update b1status set Status= (\"{}\") where PID=
(\"{}\")".format("C", g1))
cur.execute("update b1status set Tno= \"{}\" where PID=
\"{}\"".format(hg, str(g1)))
con.commit()
cur.execute("select * from b1status where PID="+str(g1))
jk= cur.fetchone()
print("")
print("New Ticket for the Passenger")
31
print("=========================================================
==============================================================
===========================")
print("Passenger ID \t", '{:>18}'.format("Passenger Name"),
'{:>28}'.format("Destination"), '{:>20}'.format("Ticket Status"), '{:>15}'.format("Train
No"))
print("=========================================================
==============================================================
===========================")
print(jk[0], "\t", '{:>25}'.format(jk[1]), '{:>30}'.format(jk[2]),
'{:>15}'.format(jk[3]), '{:>15}'.format(jk[4]))
else:
print('')
print("ERROR: Wrong Administrator Password. Please Re Enter the
Administrator Password")
print('')
if x.upper()=='GBR4':
t= input("Enter the Passenger name: ")
t2= input("Enter the Destination: ")
print('')
cur.execute("select * from b2status where Destination in (\"{}\")".format(t2))
n= cur.fetchall()
if len(n)==0:
print("Please re enter the destination for the trains through this station")
print('')
else:
32
print("Available Trains and Timings: ")
print("Train NO.", '\t', '{:>14}'.format("Timings"))
print("============================================")
for df in n:
if df[5]>0:
print(df[0], '\t', '{:>18}'.format(df[4]))
cur.execute("select PID from b1status")
n1= cur.fetchall()
fer= len(n1)+1
ji= int(input("Enter your suitable train no. as per timings: "))
cur.execute("insert into b1status values({}, \'{}\', \'{}\', \'{}\', {})".format(fer, t,
t2, 'C', str(ji)))
con.commit()
cur.execute("select * from b1status where PID= "+str(fer))
ty= cur.fetchone()
print('')
print("Congrats! your Ticket has been successfully booked!")
print('')
print("Passenger ID \t", '{:>18}'.format("Passenger Name"),
'{:>28}'.format("Destination"), '{:>20}'.format("Ticket Status"), '{:>15}'.format("Train
No"))
print("=========================================================
==============================================================
===========================")
print(ty[0], "\t", '{:>25}'.format(ty[1]), '{:>30}'.format(ty[2]),
'{:>15}'.format(ty[3]), '{:>15}'.format(ty[4]))
print('')
33
EXPERIMENTAL
RESULTS
34
CHAPTER 8
EXPERIMENTAL RESULTS
The system was constructed by entwining the concepts of SQL and Python to arrive at the
desired results. Running the application for the purpose of accomplishing the objectives of
a Train Ticket Reservation System received inputs appropriately and fed the receptions
back to the TTRS database.
35
Fig 7.2: Fetching Query to book ticket
36
Fig 7.4: Query to retrieve passenger details (Admin End)
37
Fig 7.6: Query to retrieve passenger details (Admin End)
38
Fig 7.8: Interface to Check
Train Status
40
SYSTEM TESTING
41
CHAPTER 9
SYSTEM TESTING
42
10.2.3 Validation Testing
This kind of testing ensures that the requirements established in accordance
with the software environment are validated, thus providing a needed
assurance to the stakeholder that the software meets the necessary functional,
behavioural, and performance requirements.
43
CONCLUSION
AND
FUTURE SCOPE
44
CHAPTER 10
At length, the project can be molded to become better for commercial use, adapting it in
accordance with the requirements of the day as the current markets expect. With such
brilliant Train Ticket Reservation Systems, one can always work their way about
sustainability and transform railway travels a piece of cake.
In the end, train journeys have always been favoured by many owing to the rendezvous of
the travelling medium with the beautiful nature all the while accompanied by memories to
relish, savourites to taste, and stories to tell as the train goes “Hoo-Hoo”
45
All with different roles to play
'round Tidmouth Sheds or far away
Down the hills and round the bends
Thomas and his friends
46
REFERENCES
47
CHAPTER 9
REFERENCES
Book References
[1] Wang Zongjiang, Railway Online Booking System Design and Implementation,
Physics Procedia, Volume 33, 2012, Pages 1217-1223, ISSN 1875-3892,
https://doi.org/10.1016/j.phpro.2012.05.202.
[2] S. Chatterjee, S. Das, Divisha, B. Goswami, P. Nag and C. Pradhan, "REVITS:
Railway E-Verification Information and Ticketing System," 2020 International
Conference on Communication and Signal Processing (ICCSP), Chennai, India,
2020, pp. 0992-0995, doi: 10.1109/ICCSP48568.2020.9182191.
[3] Peddi Oliva Joicy and Vidiyala Prathyusha, “Railway Reservation System”,
Easy Chair, 2021. Railway Reservation System (easychair.org)
Website References
48