0% found this document useful (0 votes)
23 views24 pages

CS Project 2024 25

The document outlines a project on a Railway Reservation System developed by Piyush Raj for his computer science class. It includes a certificate of completion, acknowledgments, required hardware and software, and a detailed introduction to the project's objectives and functionalities, such as user registration, ticket booking, and administrative operations. The project also features Python source code and MySQL database integration to manage train and customer data effectively.

Uploaded by

Harshit kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views24 pages

CS Project 2024 25

The document outlines a project on a Railway Reservation System developed by Piyush Raj for his computer science class. It includes a certificate of completion, acknowledgments, required hardware and software, and a detailed introduction to the project's objectives and functionalities, such as user registration, ticket booking, and administrative operations. The project also features Python source code and MySQL database integration to manage train and customer data effectively.

Uploaded by

Harshit kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 24

COMPUTER SCIENCE PROJECT

2024-25
 PROJECT TOPIC :
RAILWAY RESERVATION SYSTEM
Submitted By:
Name: Piyush Raj
Class: XII-B
Board roll no:
Submitted To:
Dr Indrajeet Kumar,
PGT(CS)

1|Page
CERTIFICATE
This is to certify that Piyush Raj of class: XII B of
KENDRIYA VIDYALAYA KANKARBAGH has done his
project on RAILWAY RESERVATION SYSTEM under
my supervision. He has taken interest and has
shown at most sincerity in completion of this
project.
I certify this project up to my expectation &
as per guidelines issued by CBSE, NEW DELHI.

INTERNAL EXAMINER EXTERNAL EXAMINER

PRINCIPAL

2|Page
ACKNOWLEDGMENT
It is with pleasure that I acknowledge my sincere
gratitude to our teacher, Dr. Indrajeet Kumar
who taught and undertook the responsibility of
teaching the subject computer science. I have
been greatly benefited from his classes.
I am especially indebted to our Principal MR. M.P
Singh who has always been a source of
encouragement and support and without whose
inspiration this project would not have been a
successful I would like to place on record heartfelt
thanks to him.
Finally, I would like to express my sincere
appreciation for all the other students in my
batch their friend & the fine time that we all
shared together.

STUDENT’S SIGN PRINCIPAL


SIGN

3|Page
HARDWARES AND SOFTWARES
REQUIRED
HARDWARES
1. Desktop / Laptop
2. Mobile Phone

SOFTWARES

1. Python (latest version)


2. MySQL
3. Python Connector
Module

4|Page
CONTENTS
S.No. Topic Page No.

1 Certificate 2

2 Acknowledgement 3

Hardwares and Softwares


3 Required 4

4 Introduction 6

5 Python Source Code 10

6 MySQL Database 22

5|Page
7 Outputs 25

8 References 30
INTRODUCTION
The project RAILWAY RESERVATION SYSTEM
Objectives of the Project
1. Administrative Empowerment:The core objectives of our
project are multi-faceted, addressing the intricate needs of
both administrators and passengers within the railway
ecosystem.

User Registration & Authentication


The project introduces a streamlined User Registration
process, requiring users to provide essential details such
as user ID, name, phone number, email ID, and password.
This information is securely stored in a MySQL database.
Additionally, robust User Authentication mechanisms ensure
the security and integrity of user accounts.

Administrative Functions
The Admin Panel, a focal point of the system, equips
administrators with indispensable tools:

Add Train: Administrators can add new trains to the system,


specifying crucial details such as train number,

6|Page

7|Page
name, origin, destination, journey distance, journey time,
seat availability, and fares.
Update Train Details: The system allows administrators to
modify existing train details, adapting to dynamic demands
and operational changes. This includes updating seat
availability, journey details, and fare information.
Cancel Train: In response to operational constraints or changing
demands, administrators have the authority to cancel trains,
ensuring flexibility and adaptability in the system.

2. Enhancing Customer Experience


The Customer Panel is designed with the end-user in mind,
focusing on providing an intuitive and user-friendly interface
for seamless ticket booking and management.

User Interaction
User Login: The system provides a secure login interface for
registered users, requiring user ID and password for access.
Forgot User ID: Users can retrieve forgotten user IDs
through their registered email addresses, enhancing user
experience and reducing barriers to access.

Passenger Panel Functionalities


The Passenger Panel, an extension of the Customer Panel,
offers a range of functionalities:

Train Search: Users can search for trains based on origin


and destination, providing comprehensive details about
available trains, schedules, seat availability, and fares.
8|Page
Book Tickets: The system facilitates the ticket booking
process, allowing users to select trains, classes, and
passengers for reservation.
Cancel Tickets: A streamlined process enables users to
cancel booked tickets, providing flexibility and convenience
in managing travel plans.

Key Code Functionalities Integrated

User Management Functions


New User Registration
The new_user()` function employs a systematic approach
to register new users, generating a unique user ID and
storing essential details in the MySQL database.

Forgot User ID
The `forgot_user_id()` function provides a mechanism for
users to retrieve their registered user IDs via email
verification, ensuring a smooth user experience.

Old User Authentication


The `old_user()` function verifies user credentials, allowing
access to registered users and guiding them through the
system functionalities.

Admin Panel Operations

9|Page
Admin Password Verification
The `adminpassword()` function implements a secure
password system for accessing the admin panel, ensuring
restricted access and system security.

Train Management Operations


Functions such as `add_train()`, `update_details()`, and
`cancel_train()` constitute essential operations within the
Admin Panel. These functionalities empower administrators
to add new trains, update train details, and cancel trains
when necessary.

Passenger Panel Operations

Train Search
The `Train_Search()` function allows users to search for
trains based on origin and destination, providing detailed
information about available trains.

Book Tickets
The `Book_Ticket(uid)` function simulates the ticket booking
process, allowing users to select trains, classes, and
passengers for reservation.

10 | P a g e
Cancel Tickets
The `Cancel_Ticket()` function facilitates the cancellation of
booked tickets, showcasing the system's ability to handle
modifications to user bookings.

Significance of the Project


The significance of our project extends beyond its technical
complexity; it lies in its real-world applicability. In a world
where efficient transportation is vital, an effective railway
reservation system is crucial. The project addresses the
pressing need for systems that can adapt to the evolving
demands of the railway industry while prioritizing user
satisfaction, security, and transparency.

11 | P a g e
PyTHON 1.

SOURCE CODE:
import mysql.connector as a

passwd = input("DATABASE PASSWORD: ")


con = a.connect(host="localhost", user="root", passwd=passwd)

# SELECT DATABASE IF EXISTS


c = con.cursor()
c.execute("show databases")
dl = c.fetchall()
dl2 = [i[0] for i in dl]

if 'myrailway' in dl2:
sql = "use myrailway"
c.execute(sql)
else: # CREATE DATABASE IF NOT EXISTS
sql1 = "create database myrailway"
c.execute(sql1)
sql2 = "use myrailway"
c.execute(sql2)
sql3 = """create table Train(Name varchar(50), Cost integer, Distance integer, Date
varchar(30))"""
c.execute(sql3)
sql4 = """create table Customer(Name varchar(20), Train varchar(25), Payment integer, Date
varchar(20), Phone varchar(20))"""
c.execute(sql4)
sql5 = """create table Bills(Detail varchar(20), Cost integer, Date varchar(20))"""
c.execute(sql5)
sql6 = """create table worker(Name varchar(100), Work varchar(20), Salary varchar(20))"""
c.execute(sql6)
con.commit()

# SYSTEM PASSWORD LOGIN


def signin():
12 | P a g e
print("\n")
print(" ---------->>>>>>>>>> Welcome, My Railway System [MRS] <<<<<<<<<<----------")
print("\n")
p = input("System Password: ")
if p == "piyush@1":
options()
else:
signin()

# PROJECT WORKING OPTIONS


def options():
print("""
1. Add Train
2. Book Train
3. Add Bill
4. Add Worker
5. Display Train
6. Display Payments
7. Display Bills
8. Display Workers

""")
choice = input("Select Option: ")
while True:
if choice == '1':
AddTrain()
elif choice == '2':
BookTrain()
elif choice == '3':
AddBill()
elif choice == '4':
AddWorker()
elif choice == '5':
dTrain()
elif choice == '6':
dPayments()
elif choice == '7':
dBills()
elif choice == '8':
dWorker()
else:
print("Enter Again...")
options()

# FUNCTION TO ADD NEW TRAIN DATA INTO TRAIN TABLE


def AddTrain():
n = input("Train Name: ")
13 | P a g e
c = input("Cost: ")
b = input("Distance: ")
d = input("Date: ")
data = (n, c, b, d)
sql = 'insert into Train values(%s, %s, %s, %s)'
cur = con.cursor()
cur.execute(sql, data)
con.commit()
print("Data inserted successfully")
options()

# FUNCTION TO DISPLAY DATA FROM TRAIN TABLE


def dTrain():
sql = 'select * from Train'
cur = con.cursor()
cur.execute(sql)
records = cur.fetchall()
for record in records:
print(" Name :", record[0])
print(" Cost :", record[1])
print(" Distance :", record[2])
print(" Date :", record[3])
print(".........................................")
options()

# FUNCTION TO ADD CUSTOMER BOOKING DATA INTO CUSTOMER TABLE


def BookTrain():
n = input("Customer Name: ")
s = input("Train: ")
py = int(input("Payment: "))
d = input("Date: ")
p = input("Phone: ")
data = (n, s, py, d, p)
sql = 'insert into Customer values(%s, %s, %s, %s, %s)'
cur = con.cursor()
cur.execute(sql, data)
con.commit()
print("Data inserted successfully")
options()

# FUNCTION TO DISPLAY CUSTOMER PAYMENT DATA FROM CUSTOMER TABLE


def dPayments():
sd = input("Date: ")
sql = 'select * from Customer'
cur = con.cursor()
cur.execute(sql)
records = cur.fetchall()
14 | P a g e
for record in records:
if record[3] == sd:
print("Name:", record[0])
print("Train:", record[1])
print("Payment:", record[2])
print("Date:", record[3])
print("Phone:", record[4])
print("..............................................")
options()

# FUNCTION TO ADD NEW BILLS


def AddBill():
dt = input("Details: ")
c = input("Cost: ")
d = input("Date: ")
data = (dt, c, d)
sql = 'insert into Bills values(%s, %s, %s)'
cur = con.cursor()
cur.execute(sql, data)
con.commit()
print("Data inserted successfully")
options()

# FUNCTION TO DISPLAY ALL PREVIOUS BILLS


def dBills():
sd = input("Date: ")
sql = 'select * from Bills'
cur = con.cursor()
cur.execute(sql)
records = cur.fetchall()
for record in records:
print("Detail:", record[0])
print("Cost:", record[1])
print("Date:", record[2])
print("......................................")
options()

# FUNCTION TO ADD NEW WORKERS


def AddWorker():
n = input("Name: ")
w = input("Work: ")
s = input("Salary: ")
data = (n, w, s)
sql = 'insert into worker values(%s, %s, %s)'
cur = con.cursor()
cur.execute(sql, data)
con.commit()
15 | P a g e
print("Data inserted successfully")
options()

# FUNCTION TO DISPLAY ALL WORKERS


def dWorker():
sql = 'select * from worker'
cur = con.cursor()
cur.execute(sql)
records = cur.fetchall()
for record in records:
print("Name:", record[0])
print("Work:", record[1])
print("Salary:", record[2])
print("..................................................")
options()

signin()

16 | P a g e
MySQl
DATAbASE:
:
TRAIN TABLE

PASSENGER LIST :

17 | P a g e
USER DETAILS :

BOOKED_TICKETS:

18 | P a g e
OUTPUTS:
19 | P a g e
TRAIN RESERvATION MAIN PAgE:

20 | P a g e
THE ADMIN lOgIN PANEl:

CANCEl TICKET:

21 | P a g e
bOOKINg TICKETS :

22 | P a g e
SEARCH TRAIN:

23 | P a g e
REFERENCES:
1. CLASS 11th& 12th Computer
Science Book
(SUMITA ARORA)
2.PYTHON https://www.python.org/
3.MySQL https://www.mysql.com/
4.KV Coders https://kvcoders.in
79874: 5. IRCTC:
https://www.irctc.co.in/nget/ train-
search

24 | P a g e

You might also like