railway mgmt system
railway mgmt system
railway mgmt system
Academic Session:2024-25
Project Report
on
“Railway Management System”
(For AISSCE 2024-25 Examination)
Signature of Signature of
Internal Examiner External Examiner
ACKNOWLEDGEMENT
Apart from the efforts of me, the success of any project depends largely on the
encouragement and guidelines of many others. I take this opportunity to express my
gratitude to the people who have been instrumental in the successful completion of this
project. I express deep sense of gratitude to almighty God for giving me strength for
the successful completion of the project. I am greatly indebted to Ms Madhu Sehgal,
Teacher in Computer Science who gave me immense support and guidance
throughout the completion of this project.
6. Coding 16
7. Output Screens 37
8. User Manual 44
9. Bibliography 46
5
INTRODUCTION
Users can easily book train tickets online, reducing the need to stand in
long queues at the railway station. The system provides a user-friendly
interface for browsing train schedules, selecting seats, and making
reservation. Passengers can quickly check seat availability and make
reservations based on their preferences. The system ensures accurate seat
allocation and minimizes the chances of overbooking. Users have access to
real-time information about train schedules, delays, and platform changes.
Notifications and updates are provided through various channels, including
mobile apps and online portal.
On the other hand, the program includes an admin module that empowers
administrators to efficiently manage the railway system. Administrators
can book tickets, update existing tickets information, and delete tickets as
needed. The system also shows the booking by the user.
6
OBJECTIVES AND SCOPE OF
THE PROJECT
The main objective of Railway Management System is to automate and
streamline the management of a railway system. The program offers various
features and functionalities for both customers and administrators, making the
experience efficient and convenient.
Through the proposed system users can do the following tasks – book ticket,
display ticket, delete ticket, view cart, edit information, checkout, Submit
reviews etc. in quick time. Our proposed system has the following advantages.
7
The future of Railway Management Systems holds promising advancements that can
bring about numerous advantages. Railway Management Systems may integrate
with emerging technologies such as Internet of Things (IoT), Artificial Intelligence
(AI), and Machine Learning (ML) to enhance operational efficiency, predictive
maintenance, and decision-making. Implementation of smart infrastructure,
including sensors and monitoring devices, to gather real-time data on track
conditions, equipment health, and passenger flow, contributing to improved safety
and reliability. Predictive analytics tools may be employed to anticipate equipment
failures and schedule maintenance activities proactively, reducing downtime and
minimizing service disruptions. The development and deployment of autonomous or
semi-autonomous trains that leverage advanced technologies for navigation and
control, potentially improving efficiency and safety. Improved connectivity with
other modes of transportation, such as buses, metros, and ride-sharing services, for
seamless and integrated travel experiences. Adoption of digital twin technology to
create virtual replicas of physical railway assets, enabling real-time monitoring,
analysis, and simulation for better decision-making. Integration with 5G networks
for faster and more reliable communication, enabling high-speed data transfer, real-
time video surveillance, and improved connectivity for passengers.
8
Hardware and Software
Specifications
HARDWARE REQUIREMENTS
V. Printer : LaserJet
SOFTWARE REQUIREMENTS:
9
Modules and Functions Used
10
Following modules are used in this project:
mysql.connector : MySQL Connector/Python enables Python programs to
access MySQL databases, using an API that is compliant with the Python
Database API Specification v2.0 (PEP 249). It is written in pure Python
and does not have any dependencies except for the Python Standard
Library.
tabulate : The tabulate module in Python allows easy formatting and
presentation of tabular data. It simplifies the process of creating visually
appealing tables from different data structures, such as lists or
dictionaries. With tabulate, you can choose from various table formats
and customize headers, alignment, and column formatting. It offers a
convenient way to display tabular data in a well-organized and readable
format without manual manipulation.
11
4) ticket_checking():
This function allows the admin to check the ticket he/her booked for
their destination.
5) ticket_cancelling():
This function delete the ticket admin booked
6) checking():
This function sign in to the account for the admin that he created.
7) checking_1():
This function sign up and creates an account for the admin with his/her
personal information within the sign up process
8) checking_2():
This function deletes the correct account with the approval of the admin
9) checking_3():
This function displays the account details of the admin .
10) support_issue() :
This function opens an issue ticket which is send the management in order
to provide help to the admin.
11) Feedback():
This function allows customers to give to feedback to the management
system and any changes or support needed.
13
user info
14
SOURCE CODE
# project name : Railway management system
'''
Railway Management System
By: Harsh Vardhan
School: New Era Public School, Dwarka
Class: 12
mycur.execute(s1)
def menu():
print('----------------------------------------------------\U0001F68A\U0001F686 W-
E-L-C-O-M-E \U0001F68A\U0001F686-------------------------------------------------
------------------------------')
print('1.YES')
print('2.NO')
ch = int(input('DO YOU WANT TO CONTINUE OR NOT PLEASE
\U0001F64f ENTER NUMBER:'))
while ch == 1:
print("=====================================================
==========================================================
==========================================================
===============")
print('WELCOME TO ONLINE RAILWAY RESERVATION SYSTEM')
print('1. SIGN IN')
print('2. SIGN UP')
print('3. DELETE ACCOUNT')
17
print('4. EXIT')
chl = int(input('ENTER YOUR CHOICE:'))
print("=====================================================
==========================================================
==========================================================
===============")
if chl == 1:
a = checking()
if a:
print('\U0001F68A\U0001F686 WELCOME
\U0001F68A\U0001F686')
main()
else:
continue
elif chl == 2:
a = checking_1()
if a:
main()
else:
18
print('PASSWORD ALREADY EXISTS')
continue
elif chl == 3:
c = checking_2()
if c:
print('ACCOUNT DELETED')
continue
else:
print('YOUR PASSWORD OR USER_NAME IS INCORRECT')
continue
elif chl == 4:
print("THANK YOU")
break
else:
print("ERROR 404: PAGE NOT FOUND")
break
def main():
19
print('1. YES')
print('2. NO')
c = int(input('DO YOU WANT TO CONTINUE OR NOT PLEASE
\U0001F64f ENTER NUMBER:'))
while c == 1:
print('1. TICKET BOOKING')
print('2. TICKET CHECKING')
print('3. TICKET CANCELLING')
print('4. ACCOUNT DETAILS')
print('5. HELP AND SUPPORT')
print('6. OPEN A ISSUE TICKET')
print('7. FEEDBACK')
print('8. LOG OUT')
ch = int(input('enter ur choice:'))
if ch == 1:
ticket_booking()
elif ch == 2:
ticket_checking()
20
elif ch == 3:
ticket_cancelling()
elif ch == 4:
checking_3()
elif ch == 5:
help_support()
elif ch == 6:
support_issue()
elif ch == 7:
feedback()
elif ch == 6:
print('THANK YOU')
break
else:
print('ERROR 404: PAGE NOT FOUND')
break
21
def checking_1():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
dob = f"{d}/{o}/{p}"
age = input('YOUR AGE: ')
if b == c:
try:
cl = f"INSERT INTO userinfo VALUES ('{f}', '{l}', '{a}', '{b}', '{ph}',
'{v.get(gen, 'UNKNOWN')}', '{dob}', '{age}')"
mycur.execute(cl)
print("********************************************************************************
********************************************")
print(f'WELCOME {f} {l}')
23
print("********************************************************************************
********************************************")
return True
except:
print('PASSWORD ALREADY EXISTS')
return False
else:
print('BOTH PASSWORDS ARE NOT MATCHING')
return False
def checking():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
24
a = input('USER NAME: ')
b = input('PASS WORD: ')
try:
s1 = f"SELECT user_name FROM userinfo WHERE password='{b}'"
cl = f"SELECT fname, lname FROM userinfo WHERE password='{b}'"
mycur.execute(cl)
datal = mycur.fetchall()[0]
datal = list(datal)
datal = datal[0] + ' ' + datal[1]
mycur.execute(s1)
data = mycur.fetchall()[0]
data = list(data)[0]
if data == a:
print("=====================================================
==========================================================
==================================================")
print(f' Welcome {datal}')
25
print("=====================================================
==========================================================
==================================================")
return True
except:
print('ACCOUNT DOES NOT EXIST')
return False
def checking_2():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
26
a = input('USER NAME: ')
b = input('PASS WORD: ')
try:
s1 = f"SELECT user_name FROM userinfo WHERE password='{b}'"
mycur.execute(s1)
data = mycur.fetchall()[0]
data = list(data)
if data[0] == a:
print('IS THIS YOUR ACCOUNT')
s1 = f"SELECT user_name FROM userinfo WHERE password='{b}'"
cl = f"SELECT fname, lname FROM userinfo WHERE
password='{b}'"
mycur.execute(cl)
datal = mycur.fetchall()[0]
datal = list(datal)
datal = datal[0] + ' ' + datal[1]
mycur.execute(s1)
data = mycur.fetchall()[0]
27
data = list(data)
if data[0] == a:
x = ['FIRST NAME', 'LAST NAME', 'PHONE NUMBER',
'GENDER', 'DATE OF BIRTH', 'AGE']
s1 = f"SELECT fname, lname, phno, gender, dob, age FROM
userinfo WHERE password='{b}'"
mycur.execute(s1)
data = mycur.fetchall()[0]
data = list(data)
print("=====================================================
=============================")
28
print("=====================================================
==============================")
print('1. Yes')
print('2. No')
vi = int(input('Enter your choice: '))
if vi == 1:
b1 = f"DELETE FROM userinfo WHERE password = '{b}'"
mycur.execute(b1)
return True
elif vi == 2:
print('SORRY, RETRY')
else:
print('ERROR 404: PAGE NOT FOUND')
except:
return False
print('ACCOUNT DOES NOT EXIST')
29
def checking_3():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
try:
s1 = f"SELECT user_name FROM userinfo WHERE password='{b}'"
cl = f"SELECT fname, lname FROM userinfo WHERE password='{b}'"
l1 = f"SELECT * FROM railinfo WHERE phno={c}"
mycur.execute(cl)
datal = mycur.fetchall()[0]
data1 = list(datal)
data1 = datal[0] + ' ' + datal[1]
30
mycur.execute(s1)
data = mycur.fetchall()[0]
data = list(data)
mycur.execute(l1)
data2 = mycur.fetchall()
num_rowss = mycur.rowcount
if data[0] == a:
s1 = f"SELECT fname, lname, phno, gender, dob, age FROM
userinfo WHERE password='{b}'"
mycur.execute(s1)
data = mycur.fetchall()[0]
data = list(data)
print("=====================================================
================================")
print("=====================================================
=================================")
print("-----------------------------------------------------------------------------------
")
print("=====================================================
================================")
for i in range(num_rowss):
b=[['NAME', 'PHONE NUMBER','AGE', 'GENDER', 'FROM',
'TO','DATE',],
[data2[i][0], data2[i][1], data2[i][2], data2[i][3], data2[i][4],
data2[i][5],data2[i][6]]]
print(tabulate(b,headers="firstrow",tablefmt="psql"))
32
print("=====================================================
================================")
print("-----------------------------------------------------------------------------------
")
else:
return False
print('ACCOUNT DOES NOT EXIST')
except:
menu()
33
def ticket_booking():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
nm = input('Enter your Fullname: ')
phno = input('Enter your phone number: ')
age = int(input('Enter your age: '))
def ticket_checking():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
mydb.autocommit = True
print('1. Yes')
print('2. No')
35
ch = int(input('DO YOU WANT TO CONTINUE OR NOT PLEASE
\U0001F64f ENTER NUMBER:'))
if ch == 1:
phno = input('Enter your phone number: ')
try:
s1 = f"SELECT * FROM railinfo WHERE phno = '{phno}'"
mycur.execute(s1)
data = mycur.fetchall()
Data=list(data)
num_rows = mycur.rowcount
for i in range(num_rows):
print("=====================================================
==============================")
p=[['NAME', 'PHONE NUMBER', 'AGE', 'GENDER', 'STARTING
POINT', 'DESTINATION', 'DATE'],
[data[i][0], data[i][1], data[i][2], data[i][3], data[i][4],
data[i][5],data[i][6]]]
print(tabulate(p,headers="firstrow",tablefmt="psql"))
36
print("=====================================================
==============================")
print("--------------------------------------------------------------------------------
---")
except:
print('TICKET DOES NOT EXIST')
elif ch == 2:
print('THANK YOU')
else:
print('ERROR 404: PAGE NOT FOUND')
def ticket_cancelling():
import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh",database ="railway")
mycur = mydb.cursor()
mycur.execute("use railway")
37
mydb.autocommit = True
print('1. Yes')
print('2. No')
ch = int(input('DO YOU WANT TO CONTINUE OR NOT PLEASE
\U0001F64f ENTER NUMBER:'))
if ch == 1:
phno = input('Enter your phone number: ')
sl = f"DELETE FROM railinfo WHERE phno = '{phno}'"
mycur.execute(sl)
print('TICKET CANCELLED')
elif ch == 2:
print('THANK YOU')
else:
print('ERROR 404: PAGE NOT FOUND')
def help_support():
print("For any assistance, please contact our railway service.")
print("Phone: 100-456-8000")
print("Email: railwaysupport@XYZ.com")
38
def feedback():
feedback=input("PLEASE WRITE YOUR FEEDBACK: ")
print("“Thanks so much for sharing your experience with us.” ")
def support_issue():
issuse=input("express your understanding of the issue, and provide your
perspective if necessary: ")
print("YOUR ISSUE TICKET IS BEEN SUBMITTED WE WILL GET INTO
CONTACT WITH YOU IN 24 HOURS")
menu()
39
Output Screens
40
41
42
43
44
45
46
47
User Manual
Upon running the program, the main menu will be displayed with the
following options:
1. Admin Login
2. Ticket_booking
If you choose "Admin Login," you will be prompted to enter the admin ID and
password. Upon successful login, the admin will have access to the following
options:
1. Sign IN: Allows the admin to sign in into his/her accounts with the created
username and password.
2. Sign UP: Allow to admin to create an accounts with his/her personal details
3. Delete Account: Allows the admin to delete the account he/she created for
themselves.
48
When you come to ticket centre you will have access to the following options:
2. View Ticket: Allows you to search the ticket you book with your phone
number.
3. Delete Ticket: Allows the admin to delete the Ticket he/she booked
49
Bibliography
Websites:
1) https://www.w3schools.com
2) https://www.python.org
3) https://www.mysqltutorial.org
Books:
1) Computer science with python by Sumita Arora
2) Computer science with python by Preeti Arora
50