The document is an acknowledgment section expressing gratitude to a teacher, principal, and fellow students for their support during a project. It also outlines the functionalities of a Railway Reservation System, detailing user registration, ticket booking, and administrative operations. The system aims to enhance customer experience and streamline train management through various user-friendly features.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0 ratings0% found this document useful (0 votes)
15 views29 pages
computer 1 part go
The document is an acknowledgment section expressing gratitude to a teacher, principal, and fellow students for their support during a project. It also outlines the functionalities of a Railway Reservation System, detailing user registration, ticket booking, and administrative operations. The system aims to enhance customer experience and streamline train management through various user-friendly features.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 29
ACKNOWLEDGMENT
It is with pleasure that | acknowledge my sincere
gratitude to our teacher, MR. Faizan sir
who taught and undertook the
responsibility of teaching the subject computer
science. | have been greatly benefited from his
classes.
| am especially indebted to our Principal MR.
SHIVAPRIYA DASH who has always been a source
of encouragement and support and without
whose inspiration this project would not have
been a successful | would like to place on record
heartfelt thanks to him.
Finally, | 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|Pagename, 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:
7|Pageee Outputs 25
8 References 30
INTRODUCTION
The project RAILWAY RESERVATION SYSTEM
Objectives of the Project
1. Administrative EmpowermentThe 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|PageAdmin Panel Operations
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.
9|Page
eeCONTENTS
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
S|PageHARDWARES AND SOFTWARES
REQUIRED
HARDWARES
1. Desktop / Laptop
2. Mobile Phone
SOFTWARES
1. Python (latest version)
2. MySQL
3. Python Connector
eo Module
SQL
4|PageTrain Search: Users can search for trains based on
origin and destination, providing comprehensive details
about available trains, schedules, seat availability, and fares.
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.
8|Pagei. #PASSENGER PANEL FUNCTIONALITIES
280. def Train_Search():
281. dbo=con.connect(host="localhost",user="root", password="admi
“train_reservation")
,database=
282. bo.cursor()
283. input(""Enter your origin: ")
284. input("Enter your destination: ")
285. _co.execute("select * from train_schedule where origin like "%{)%" and
destination like '%{)%" format(o,d))
286. a=co.fetchalll()
287. foriina:
288.
289.
290. i igin: ",a[0}{2])
291. estination: ",a[0][3])
292.
293.
294,
295. eats in act: ",a[0][6])
296. i (o)t71)
297. ,a[0}[8])
298. “a[o][9])
299. are of si: ",a[0][10])
300. _print("Fare of gen: ",a[0][11])
301. dbo.commit()
i, #BOOK TICKETS
302. def Book_Ticket(uid):
303. dbo=con.connect(host="localhost",user="root",password="admin" database=
“train_reservation")
304. co=dbo.cursor()
305. _print("THIS IS OUR ALL TRAINS AVAILABLE \n
")
elect train_no,train_name,origin,destination from train_schedule”
307. co.execute(op)
308. r=co.fetchall()
309. columns=[i{0] for i in co.description]
310. print(tabulate(r,headers
olumns,tablefmt="fancy_grid"))
314. print" —--\n\n")
312. _trainno=int(input("Enter your Train no: "))
313. _tcktno=int(input("Enter no of seats you want to book: "))
314. "4. AC TICKET")
315. . SL TICKET")
316. . GEN TICKET")
317. _ typ=int(input("Enter your choice of class: "))
318. iftyp==t:
20|Page250. elif x==14:
251. print("**********YOU ARE NOW OUT OF UPDATE DETAILS SECTION********###")
252. break
253. return
i. #CANCEL TRAIN
254. def cancel_train():
255. dbo=con.connect(host="localhost",user="root" passwor'
“train_reservation")
256. bo.cursor()
257. ct=int(input("enter train no which you want to cancel: "))
258. _co.execute("delete from train_schedule where train_no=(}" format(ct))
259. dbo.commit()
260. print("*********** Train cancelled Successfully ****************")
i. #ADMIN PANEL OPTIONS
261. def admin_panel():
262. while True:
263.
264. raone- =
265. “Welcome to admin panel******
266. - Add train")
267. "2, Update details")
268. . Cancel Train")
269. print("4. Log out")
270. _opt=int(input("Choose your option: "))
271. ifopt=
a. add_train()
272. elif opt 4
a. update_details()
2rd
274.
1
275.
276.
277.
278.
279.
19|Page214. input("Enter updated no of seats in GEN: ")
215. co.execute("update train_schedule set gen="{}' where train_no=()".
formatitsg,tno))
216. ***+* UPDATED SUCCESSFULLY********")
217. saan oo
218. dbo.commit()
219. return
i. # To Update fare price of AC of that train
220. elif x==11
221. — - 4
222. (rsessaeees¥QU ARE GOING TO UPDATE FARE PRICE OF AC “ty
223. _tno=int(input("Enter train no whose fare price of ac you want to update: "))
224. put(""Enter updated fare price of ac: ")
225. —_co.execute("update train_schedule set ac_fare={} where train_no=(}".
formatitfa,tno))
226. _print("******UPDATED SUCCESSFULLY*******")
227. _print("-— =
228. dbo.commit()
229. return
i. #To Update fare price of SL of that train
230. elif x==12:
231.
232. “s*-«~**YQU ARE GOING TO UPDATE FARE PRICE OF SL***********")
233. int(input("Enter train no whose fare price of SL you want to update: "))
234. _tfs=input("Enter updated fare price of SL: ")
235. _co.execute("update train_schedule set sl_fare={} where train_no=(}".
formatitfs,tno))
236. _print("******UPDATED SUCCESSFULLY********")
237. i
238. dbo.commit()
239. return
i. #To Update fare price of GEN of that train
240. elif x==13;
241. print("-——~ —"
242. _print("**********YOU ARE GOING TO UPDATE FARE PRICE OF GEN*******+*"*")
243. int(input("Enter train no whose fare price of GEN you want to update: "))
244. put("Enter updated fare price of GEN: ")
245. —_co.execute("update train_schedule set gen_fare=(} where train_no=()".
format(tfg,tno))
246. —_print("******UPDATED SUCCESSFULLY*******"
247. i —
248. dbo.commit()
249. return
18|Page179. return
i. #To Update journey time
180.
181.
182. _print("*****""YOU ARE GOING TO UPDATE JOURNEY TIME*™” “7
183. int(input("Enter train no whose journey_time you want to updat
184, input("Enter updated journey time: ")
185. _co.execute("update train_schedule set total_time="Q' where train_no={}".
format(tj,tno))
186. print("*******UPDATED SUCCESSFULLY********"
187. print("-——- =
188. dbo.commit()
189. return
# To Update no of seats in ac coach of that train
190. i
191. a _")
192. print("**********YOU ARE GOING TO UPDATE SEATS IN AC********###"")
193. int(input("Enter train no whose no of seats in AC you want to update: "))
194, input("Enter updated no of seats in AC
195. _co.execute("update train_schedule set act="{}' where trail
formatitsa,tno))
196. _print("*****"* UPDATED SUCCESSFULLY********"
197. int(" =
198. dbo.commit()
199. return
# To Update no of seats in SL coach of that train
200. ;
201. = = =a
202. int("**********YOU ARE GOING TO UPDATE SEATS IN SL********")
203. int(input("Enter train no whose no of seats in SI you want to update: "))
204. =input("Enter updated no of seats in SI: ")
205. —_co.execute("update train_schedule set sI=")' where train_no={}".
formatitss,tno))
206. _print("*****“UPDATED SUCCESSFULLY********"
207. _print("—~ )
208. dbo.commit()
209. return
# To Update no of seats in GEN coach of that train
210. elif x==10:
211. print("— =
212. __print("*******"**YOU ARE GOING TO UPDATE SEATS IN GEN******#***")
243. tno=int(input("Enter train no whose no of seats in GEN you want to update: "))
17 |Page141. print("-——- )
442. print("****""="YOU ARE GOING TO UPDATE TRAIN ORIGIN")
143. (input("Enter train no whose origin you want to update: "))
144, input("Enter updated train origin: ")
145. _co.execute("update train_schedule set origin="{}" where train_no={}".
format(orgn,tno))
148. _print("****** UPDATED SUCCESSFULLY******""
147. print("—— a os
148. dbo.commit()
149. return
i. # To Update train destination
150. elif x=:
151. print("------ saa — )
152. _print("*********YOQU ARE GOING TO UPDATE TRAIN DESTINATION*********")
153. _tno=int(input("Enter train no whose destination you want to update: "))
154. _td=input("Enter updated train destination: ")
155. _co.execute("“update train_schedule set destination="{}' where train_no=(}".
format(td,tno))
156. _print("******UPDATED SUCCESSFULLY********")
187. _print("— —
158. dbo.commit()
159. return
i. #To Update journey distance
160. elif x=
161. _print(" ')
162. _print("**********YOU ARE GOING TO UPDATE JOURNEY DISTANCE **********
163. _tno=int(input("Enter train no whose journey dist you want to update: "))
164. _tjd=input("Enter updated journey dist: ")
165. _co.execute("update train_schedule set journey_distance="{}' where
train_no=()". format(tjd,tno))
166. “++ UPDATED SUCCESSFULLY********")
167. _
168. dbo.commit()
169. return
i. #To Update the days train is available
170. if x==6:
471. print("-———- )
172. print("*******"YOU ARE GOING TO UPDATE AVAILABLE DAYSt*tesesteneny
173. tno=int(input("Enter train no whose avl_days you want to update: "))
174. _ tad=input("Enter updated available days: ")
175. _co.execute("update train_schedule set avi_days ="{}' where train_no={)".
format(tad,tno))
176. _print("******* UPDATED SUCCESSFULLY*******"
177. print("— -
178. dbo.commit()
16|Page104. . Update train no”)
105. . Update train name")
106.
107. . Update train destination")
108. . Update journey dist")
109. . Update available days")
110. . Update journey time")
111. . Update no of seats in AC")
112, . Update no of seats in SL")
113. 0. Update no of seats in GEN")
114, 1. Update of AC")
115. 2. Update price of SL")
116. 3. Update price of GEN")
itn 4. Exit")
148. _x=int(input("Enter your choice to use: "))
119. while True:
# To Update train no
120. it
121. — —- —"
122. “+++ OU ARE GOING TO UPDATE TRAIN NO“)
123. tname=input("Enter train name whose no you want to update: ")
124. _tno=int(input("Enter updated train no: "))
125. _co.execute("update train_schedule set train_no=(} where train_name='{}".
format(tno,tname))
126. _print("******* UPDATED SUCCESSFULLY********"
127. print("—
128. dbo.commit()
129. return
i. #To Update train name
130.
131. —_
132. “149448 OU ARE GOING TO UPDATE TRAIN NAME**####")
133. _tno=int(input("Enter train no whose name you want to update: "))
134. tname=input("Enter updated train name: ")
135. _co.execute("update train_schedule set train_name="{)' where train_no=(}".
format(tname,tno))
136. _print("*******UPDATED SUCCESSFULLY********"
137. print("----
138. dbo.commit()
139. return
i. # To Update train origin
140. elif x==3:
15|Page69. password=(input("Enter your password: "))
70. if password=="CLASS12CS":
71. prin access Granted
72.print("--
73.admin_panel()
76. print("--
77.adminpassword()
i. #ADD TRAIN
78.def add_train():
79.dbo=con.connect(host="localhost",user="root",password="admin" database="train_
reservation")
80.co=dbo.cursor()
put("Enter train origin:
input("Enter train destination: ")
t(input("Enter train journey distance: "))
input("Enter train journey time: ")
int(input("Enter no of seats in A‘
t(input("Enter no of seats in SL: "))
t(input("Enter no of seats in GEN: "))
t(input("Enter price of AC:
t{input("Enter price of SL:
)
96.co.execute(“insert into train_schedule values
(0,'0','0''0',0;'0'0,0,0,0,0,0,'0')" format(a,b,c,d,e,9,h,i,),k,1m,n))
97. print("*********You have added a new train details successfully************")
98.dbo.commit()
i. #UPDATE TRAIN TABLE
99. def update_details():
100. dbo=con.connect(host="localhost",user="root",password="admin",database=
“train_reservation")
101. co=dbo.cursor()
102. _print(”
103. print(”
“**Welcome to update train system******"
14|Page35.co.execute("select user_id from user where user_id like '{}'".format(uid))
36.b=co.fetchall()
is not registered —
--\n")
. Try again")
. Forgot user id")
Register as a new user")
int(input("Choose an option from above: "))
1:
47. elif choose==2:
48. forgot_user_id()
49. elif choose==3:
50.new_user()
52. pas=input("Enter your password: ")
53.co.execute("select password from user where password like '{}"".format(pas))
54.n=co.fetchall()
55.for i inn:
56. if pas
a. print("\n. nennneeeeeeeee\N")
b. print("----------Welcome back sir/ma‘am what's your
¢. passenger_panel(uid)
i. #PASSWORD FUNCTION FOR ACCESS TO USER PANEL
57. def user_panel():
61. out=int(input("Enter your choice: "))
62.if out==1:
63.new_user()
64.elif out==2:
67.main_menu()
i. #PASSWORD FUNCTION FOR ACCESS TO ADMIN FUNCTION
68.def adminpassword():
13|Pageimport random
from tabulate import tabulate
import mysql.connector as con
dbo=con.connect(host="localhost",user="root",password="admin" database="train_
reservation")
5. co=dbo.cursor()
POENP
i. #NEW USER REGISTRATION SECTION
6. def new_user():
7, dbo=con.connect(host="localhost",user="root",password="admi
reservation")
8. co=dbo.cursor()
9. import random
10. pid=random.randint(0,1000)*40
14. print
12. print(" \n Welcome to our reservation system \n Reg
system")
13.uid=input("Enter your user id:
14,name=input("Enter your name:
(“Enter your phone ni
database:
=input("Enter your password: ")
18.co.execute("insert into user values
(10',0;'0',0,'0,'0')" format(uid, pid,name,pno,eid,pwd))
19. print("************* Congratulations!!! Your id is successfully created **************")
20. print("=-—-—-~ ,)
21.dbo.commit()
i. #FORGET USER ID
22.def forgot_user_id():
23.dbo=con.connect(host
reservation")
24.co=dbo.cursor()
25.email=input("Enter your registered email: ")
26.co.execute("select user_id from user where email_id like '{}"".format(email))
27.emel=co.fetchall()
28.for i in emel:
29. print("Your user_id i
“localhost",user="root",password="admin",database="train_
(i[0}))
i. #old user id
30.def old_user():
31.dbo=con.connect(host="localhost",user="root",password="admi
reservation")
32.co=dbo.cursor()
,database="train_
12|Page11| PageCancel 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.
10|PagexxxxttWelcome to passenger panel******
1. Train Search
2. Book Ticket
3. Cancel Ticket
4. Log out
Enter your choice to use: 3
enter pnr no. you want to cancel: 545868
aaxxxateta* Your ticket cancelled Successfully ***ttttrtaxtaee
BOOKING TICKETS :
Enter your Train no: 12321
Enter no of seats you want to book: 2
1. AC TICKET
2. SL TICKET
3. GEN TICKET
Enter your choice of class: 1
2850
Enter customer name: snehashish
Enter your age: 18
re For gender M=Male, F=Female, O=Other -----------------
Enter your gender: m
Your PNR no is: 216440
Enter customer name: bansika
Enter your age: 17
wocere secre anne For gender M=Male, F=Female, 0=Other -----------------
Enter your gender: f
Your PNR no is: 545868
Your total ticket price is: 5700THE ADMIN LOGIN PANEL:
*xx***Welcome to admin panel******
1. Add train
2. Update details
3. Cancel Train
4. Log out
Choose your option: 2
train_no | train_name origin destination
11020 KONARK EXPRESS Bhubaneswar CSMT
11209 HIRAKUD EXP BALASORE BHADRAK
12321 MUMBAI MAIL HOWRAH JN CSMT
12347 RAJDHANI EXP DELHI JAMMU KASHMIR
12457 HOWRAH EXP CSMT DELHI
12472 SWARAJ EXPRESS JAMMU BANDRA TERMINUS
12809 HOWRAH EXPRESS CSMT HOWRAH
12841 COROMONDAL EXPRESS SHALIMAR CHENNAI
20807 HIRAKUD EXPRESS VISAKHAPATNAM AMRITSAR
20861 PURI ADI SF PURI SURAT
123432 PRASANTI EXPRESS Puri Chennai
28|PageTRAIN RESERVATION MAIN PAGE:
**x%***X*WELCOME TO TRAIN RESERVATION SYSTEM********
1. Admin panel
2. Passenger panel
3. Exit
Enter your choice: 1
Enter your password: CLASS12CS
SRAKKKAREAAEAEEAEARCCESS Granted *** eee ek kkk
******Welcome to admin panel******
1. Add train
2. Update details
3. Cancel Train
4. Log out
Choose your option: 1
Enter train no: 12347
Enter train name: RAJDHANI EXP
Enter train origin: DELHI
Enter train destination: JAMMU KASHMIR
Enter train journey distance: 1200
Enter train journey time: 9 HR 30MIN
Enter no of seats in A 290
Enter no of seats in SL: 200
Enter no of seats in GEN: 300
Enter price of AC: 3900
Enter price of SL: 900
Enter price of GEN: 500
:SMTWTHEFS
27| Page26|PageUSER DETAILS
[re
cot
Bus
renee
ty
om
oe
PCM
| 814427568
5551234
2514584
Ebi
EIS)
Asish Kumar
aU
ated |
eee
aad
Ty
asish@123
john@
oh
pty
rst
comme
ae
Cesar
oo
sheetal19
oy
chal
456321456
451024526
obras)
toed
errs!
vinit
rel
ey
re)
|
|
|
|
| mohit =|
|
|
|
|
avk18 |
BOOKED_ TICKET:
OU OSC Ha caanscl 3
OUR eC Lala amas
AER
SacerTRAIN TABLE:
24|Page23|Page
ee386. _print("******Welcome to passenger panel"****"
357. . Train Search")
358. . Book Ticket")
359. . Cancel Ticket")
360. . Log out")
361. ronnie your choice to use: "))
362.
363.
364.
365.
366.
367.
368.
369. menu()
370. int("***You are successfully logged out of Passenger panel*****")
371. —")
i. #Panel functions
372. def main_menu():
373. —- —
374. _print("********WELCOME TO TRAIN RESERVATION SYSTEM*******
375. _print("4. Admin panel")
376. _print("2. Passenger panel")
377. _print("3. Exit")
378. t(input("Enter your choic
379. while True:
380. if ch==1:
381. adminpassword()
382. elif ch=:
383. user_panel()
384,
385.
386.
387.
388.
22|Pageprint(b[0][0])
322. elif typ==2:
323. a=co.execute("select s|_fare from train_schedule where
" format(trainno))
324. b=co.fetchall()
325. _print(b[0][0])
326. elif typ==3:
327. a=co.execute("select gen_fare from train_schedule where
train_no=()".format(trainno))
328. .fetchalll()
329. _print(b[0][0])
330. —_ for i in range (tektno):
331. cust=input("Enter customer name:
332.
333.
334.
335.
336.
337.
338.
339.
341.
342. _print("Your total ticket price is:
343. dbo.commit()
344. def Cancel_Ticket():
345. dbo=con.connect(host="localhost",user="root",password="
“train_reservation")
346. co=dbo.cursor()
‘admin",database=
347. _pnr=int(input("“enter pnr no. you want to cancel: "))
348. —_co.execute("delete from booked_tickets where pnr_no={}".format(pnr))
349. dbo.commit()
350. —_print("*********** Your ticket cancelled Successfully ***********#=*#"")
i. #PASSENGER PANEL
351. def passenger_panel(uid)
352. dbo=con.connect(host="localhost",user="root",password="admin" database=
“train_reservation")
353. co=dbo.cursor()
354. while True:
355. —_print("-----
2|Page1. CLASS 11TH& 12TH COMPUTER
SCIENCE BOoK
(SUMITA ARORA)
2.PYTHON
HTTPS:77WWW.PYTHON.ORGZ
3.MYSQL
HTTPS:/7WWW.MYSQL.COM/
4.KV CODERS
HTTPS:77KVCODERS.IN
79874: 5. IRCTC:
HTTPS:7/7WWW.IRCTC.CO.IN7NGETZ
TRAIN-SEARCH
31| PageSEARCH TRAIN:
Enter your origin: csmt
Enter your destination: delhi
Train no.: 12457
Train name: HOWRAH EXP
Origin: CSMT
Destination: DELHI
Journey distance: 4500
Available days: SM THWS
total time: 55HR 54MIN
Seats in acl: 58
Seats in sl: 56
Seats in GEN: 54
Fare of acl: 2600
Fare o£ siz 300
Fare of gen: 365
30|Page