railway mgmt system

Download as pdf or txt
Download as pdf or txt
You are on page 1of 49

Vandana International School

Academic Session:2024-25

Project Report
on
“Railway Management System”
(For AISSCE 2024-25 Examination)

Submitted by- Project Guide -


Roll No: Ms. Madhu Sehgal
Name: PGT(Computer Science)
Class: XII
Subject: Computer Science
Subject Code: 083
Certificate
This is to certify that ___________of Class XII, Vandana
International School, has successfully developed his/her
Computer Science Project titled ”Railway Management
System”, under my supervision. The work done by him/her is
original and is submitted for the AISSCE(Session 2024-25) as
prescribed by CBSE.

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.

I express my heartfelt gratitude to my parents for constant encouragement while


carrying out this project. I gratefully acknowledge the contribution of the individuals
who contributed in bringing this project up to this level, who continues to look after me
despite my flaws, The guidance and support received from all the members who
contributed and who are contributing to this project, was vital for the success of the
project. I am grateful for their constant support and help.
Index
S. No. Title Page Nos.

1. Introduction to the Project 6

2. Objective & Scope of the Project 7

3. Hardware and Software Requirements 9

4. Modules and Functions used 10

5. Database and Tables used 14

6. Coding 16

7. Output Screens 37

8. User Manual 44

9. Bibliography 46

5
INTRODUCTION

A Railway Management System is a comprehensive software solution


designed to efficiently manage various operations and processes within a
railway network. It plays a crucial role in automating and streamlining
tasks associated with railway operations, ensuring smooth functioning,
better control, and enhanced customer service.

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.

Overall, the Railway Management System developed by Harshvardhan


offers a robust solution for railway management. It simplifies operation, A
friendly easy to use, and provides a better experience for customers.

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.

The purpose of the project is to build an application program to reduce the


manual work for managing the information and long queues.

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.

. User friendly interface


. Fast access to database
. Reduced error
. More Storage Capacity
. Search facility
. Look and Feel Environment
. More efficient

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

I. PROCESSOR : Intel CORE i5

II. RAM : 8GB

III. Hard disk : 1 TB

IV. CD/DVD r/w multi drive combo: Pen-drive

V. Printer : LaserJet

SOFTWARE REQUIREMENTS:

I. OPERATING SYSTEM : WINDOWS 10

II. PROGRAMMING LANGUAGE : Python 3.10.2


III. RDBMS : MySQL Server and Client

9
Modules and Functions Used

Front end: The front end was designed using Python.


Python is an interpreted, object-oriented, high-level programming language
with dynamic semantics. Its high-level built in data structures, combined with
dynamic typing and dynamic binding, make it very attractive for Rapid
Application Development, as well as for use as a scripting or glue language to
connect existing components together. Python's simple, easy to learn syntax
emphasizes readability and therefore reduces the cost of program maintenance.
Python supports modules and packages, which encourages program modularity
and code reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major platforms, and
can be freely distributed.

Back end: The backend was designed using MySQL.


MySQL is a relational database management system (RDBMS) developed by
Oracle that is based on structured query language (SQL).MySQL is integral to
many of the most popular software stacks for building and maintaining
everything from customer-facing web applications to powerful, data-driven
B2B services. Its open-source nature, stability, and rich feature set.

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.

Following functions have been used in this project :


1) menu():
This function helps the admin to login into his/her account or create an
account for themselves.
2) main():
This function creates a menu with certain work for the admin.
3) ticket_booking():
This function allows the admin to book a ticket with his/her destination to.

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.

12) help_support ():


This function provides contact information for customer support.
12
Database and Tables Used

Database used in this project :


 railway
Tables used in this project :
 railinfo

13
 user info

14
SOURCE CODE
# project name : Railway management system

# made by: Harsh Vardhan

'''
Railway Management System
By: Harsh Vardhan
School: New Era Public School, Dwarka
Class: 12

from tabulate import tabulate


import mysql.connector
mydb = mysql.connector.connect(host ="localhost",user ="root",passwd
="*Harsh")
mycur = mydb.cursor()
mycur.execute("create database if not exists railway")
mycur.execute("use railway")

s1 = """CREATE TABLE IF NOT EXISTS railinfo(


Name VARCHAR(100),
15
Phno VARCHAR(15) PRIMARY KEY,
age INT(4),
gender VARCHAR(50),
from_f VARCHAR(100),
to_t VARCHAR(100),
date_d VARCHAR(20)
)"""

mycur.execute(s1)

s1 = """CREATE TABLE IF NOT EXISTS userinfo (


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)
)"""
16
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

f = input("FIRST NAME: ")


l = input("LAST NAME: ")
a = input('USER NAME: ')
b = input('PASS WORD(3 LETTERS ONLY): ')
c = input("RE-ENTER YOUR PASS WORD: ")
ph = input("PHONE NUMBER(10 DIGIT): ")
gen = input("ENTER YOUR GENDER('M=MALE', 'F=FEMALE', 'N=NOT
22
TO MENTION'):" )

print("ENTER YOUR DATE OF BIRTH")


d = input("DD: ")
o = input("MM: ")
p = input("YYYY: ")

dob = f"{d}/{o}/{p}"
age = input('YOUR AGE: ')

v= {'m': 'MALE', 'f': 'FEMALE', 'n': 'NOT TO MENTION'}

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("=====================================================
=============================")

l=[['FIRST NAME', 'LAST NAME', 'PHONE NUMBER', 'GENDER',


'DATE OF BIRTH', 'AGE'],
[data[0], data[1], data[2], data[3], data[4], data[5]]]
print(tabulate(l,headers="firstrow",tablefmt="psql"))

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

a = input('USER NAME: ')


b = input('PASS WORD: ')
c = input('Enter phoneNo:')

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("=====================================================
================================")

x=[['FIRST NAME', 'LAST NAME', 'PHONE NUMBER', 'GENDER',


'DATE OF BIRTH', 'AGE'],
31
[data[0], data[1], data[2], data[3], data[4], data[5]]]
print(tabulate(x,headers="firstrow",tablefmt="psql"))

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

print("TRAINS BOOKED IN THIS ACCOUNT")

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: '))

print('M-MALE', '\nF-FEMALE', '\nN-NOT TO MENTION')


gender = input('Enter your gender: ')
gender = gender.upper()

fr = input('Enter your starting point: ')


to = input('Enter your destination: ')
datel = input('Enter date (dd): ')
date2 = input('Enter month (mm): ')
date3 = input('Enter year (yyyy): ')
34
date = f"{datel}/{date2}/{date3}"

a = {'M': 'MALE', 'F': 'FEMALE', 'N': 'NOT TO MENTION'}


v = a[gender]

s1 = f"INSERT INTO railinfo VALUES ('{nm}', '{phno}', {age}, '{v}', '{fr}',


'{to}', '{date}')"
mycur.execute(s1)
print('BOOKED SUCCESSFULLY')

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.

4. Exit: Exits the admin module.

48
 When you come to ticket centre you will have access to the following options:

1. Ticket Booking: Allows the admin to book a ticket.

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

4. Accounts Details: Displays all information about the accounts.

5. Open a ticket: Allows you to submit a an open ticket to the management


explaining about your issues.

6. Help And Support: Provides contact information for customer support.

7. Exit: Exits the customer module.

 If you choose "Exit", you will be exited from the program

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

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy