Railway
Railway
Railway
ON
At the outset . I am offering gratitude to my guide. who gave me great insight into what had
to be done, and for their encouragement , without which it couldn't have been possible to
complete this project.
I am indicated to my friend for help me to prepare this project and for several useful
suggestion.
I would also like to thank to every one of the organization who help me in preparing this
project and who guided me and gave my many useful suggestion by time to time in resolving
difficulties.
I hope that my effort on the project will fully satisfy experts who will examine this project.
And I pray god to give me success and brilliance in the field of computer . It's my first
opportunity by SCHOOL. So very thankful to give me first golden occasion in my life. And I
will Thanks to all.
NAME:- ASHMIT
CLASS:- XII-B
Certificate
It Certified that this project report "Railway Reservation System " is the bonafidework by
ASHMIT who carried out the project work under my supervision, towards partial fulfillment
of the requirements for XII-B Which deals with booking of room and search of room status.
NAME:- ASHMIT
CLASS:- XII-B
____________. _____________
INDEX
1. CERTIFICATE
2. ACKNOWLEDGEMENT
3. INTRODUCTION
4. HARDWARE AND
SOFTWARE REQUIREMENTS
6. CONCLUSTION
INTRODUCTION
This software also maintains Railway Reservation, Cancellation, Waiting Listing, and
Passenger Information etc.
This program is capable of holding any number of Train Record and Reservation Records.
The object of this project is to monitor the performance of Railway Ticket Reservation. The
performance of Railway Reservation will be monitored by Reservation/ Cancellation. Fair
will calculate according to the distance of journey.
HARDWARE AND SOFTWARE REQUIREMENTS
HARDWARE CONFIGURATION
RAM : 4 GB
SOFTWARE CONFIGURATION
Database : Mysql
PRINT SCREEN
CODING
main.py
def start():
while(True):
print(" Welcome to Railway Reservation System ")
print(" ----------------------------------------------------- ")
print("Enter 1. User Login")
print("Enter 2. Admin Login")
print("Enter 3. New User Register")
print("Enter 4. To exit")
try:
a=int(input("Select a choice from 1-4: "))
print()
#//==============================user=============================================
======
if(a==1):
import login
nm = input("Enter User Name: ")
pa = input("Enter User Password: ")
s=login.logindt(nm,pa)
print(s)
if (s>0):
print("Login Sucessfully")
import Welcome
else:
print("Login or Password is Worng")
#
//==================================admin=========================================
==========
if (a == 2):
nm = input("Enter Admin ID: ")
pa = input("Enter Admin Password: ")
import Adminlogin
s = Adminlogin.logindt(nm, pa)
if (s>0):
import AdminPanel
print("Login Sucessfully")
else:
print("Login or Password is Worng")
#
//================================register========================================
===============
elif(a==3):
elif(a==4):
break
else:
print("Please enter a valid choice from 1-4")
except ValueError:
print("Please input as suggested.")
start()
new register.py
import mysql.connector
# for new register
mycursor = mydb.cursor()
sql = "INSERT INTO reg VALUES ('" + a + "', '" + b + "','" + c + "', '" + d + "')"
mycursor.execute(sql)
mydb.commit()
# end
login.py
import mysql.connector
# for login
mycursor = mydb.cursor()
print(a)
print(b)
mycursor.execute("SELECT * FROM reg where usernm='" + a + "' and password='" + b
+ "'")
myresult = mycursor.fetchall()
for x in myresult:
ct1 = ct1 + 1
if (ct1 >0):
return ct1
# print("Login Sucessfully")
# import welcome
# welcome.vp_start_gui()
# end
welcom.py
def start():
while(True):
print(" Welcome to Railway Reservation System ")
print(" ----------------------------------------------------- ")
print("Enter 1. About Us")
print("Enter 2. Train List")
print("Enter 3. Train Booking")
print("Enter 4. Cancel Booking")
print("Enter 5. Booking Details")
print("Enter 6. FeedBack")
print("Enter 7. To Back")
try:
a=int(input("Select a choice from 1-7: "))
print()
#//==============================Restaurants
Aboutus===================================================
if(a==1):
import Aboutus
# //==================================Food Menu Item
List===================================================
if (a == 2):
import Train_List
# //================================Booking
Item=======================================================
elif(a==3):
nm = input("Enter User Name: ")
emid = input("Enter User Email Id: ")
mobb = input("Enter User Mobile: ")
trnuo= input("Train Number: ")
living_from = input("FROM: ")
going_to = input("TO: ")
tclass = int(input("CLASS 1. FOR NON AC- 2. FOR AC: "))
No_seatBook = int(input("No of Booking Seat: "))
dttt = input("Enter Date (MM/DD/YYYY): ")
import Booking
Booking.bookingdt(nm,emid,mobb,trnuo,living_from,going_to,tclass,No_seatBook,dttt)
# print("Record Inserted.")
# //================================Cancel
Item=======================================================
elif(a == 4):
import cancel
bd = input("Enter Booking Id: ")
cancel.canceldt(bd)
print("Record Remove.")
# //================================Booking Transactions
Details=======================================================
elif(a == 5):
a1 = input("Enter Booking Id: ")
import bookingtrandetails
bookingtrandetails.bokkdt(a1)
#
//================================FeedBack========================================
===============
elif(a == 6):
elif(a==7):
import Main
break
else:
print("Please enter a valid choice from 1-4")
except ValueError:
print("Please input as suggested.")
start()
Aboutus.py
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
print("---------------------------------------------------------------------------
--------------------------------------------------")
Booking.py
import random
import mysql.connector
from array import array
def bookingdt(a,b,c,d,e,f,g,h,dtt):
ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
totalamt=g*(h*1000)
x = random.randint(12980, 50876)
randomRef = str(x)
sql = "INSERT INTO trainbooking VALUES ('" + randomRef + "', '" + a + "','" + b +
"', '" + c + "', '" + d + "','" + e + "','" +f + "', '" +str(g) + "', '" + str(h)
+ "', '" +str(totalamt) + "', '" + dtt + "')"
mycursor.execute(sql)
mydb.commit()
print("Successfully Booking")
print("Your Booking Id: ", randomRef)
print("Your Total Ticket Price is: ", totalamt)
# end
Bookingdetails.py
import mysql.connector
def bokkdt(a1):
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
print(a1)
print('BOOKING ID ',f'{row[0]:>12}')
print('NAME ',f'{row[1]:>12}')
print('EMAIL ID ',f'{row[2]:>12}')
print('MOBILE NO ', f'{row[3]:>12}')
print('TRAIN NO ',f'{row[4]:>12}')
print('FROM ', f'{row[5]:>12}')
print('TO ', f'{row[6]:>12}')
print('1. NON AC & 2. AC ',f'{row[7]:>12}')
print('NO OF SEAT ',f'{row[8]:>12}')
print('TOTAL AMOUNT ',f'{row[9]:>12}')
print('DATE ', f'{row[10]:>12}')
#bokkdt()
cancel.py
import mysql.connector
# for new register
def canceldt(a):
ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
# end
feebcak.py
import mysql.connector
# for new register
mycursor = mydb.cursor()
sql = "INSERT INTO feedback VALUES ('" + a + "', '" + b + "','" + c + "', '" + d +
"')"
mycursor.execute(sql)
mydb.commit()
# end
Adminlogin.py
import mysql.connector
# for login
mycursor = mydb.cursor()
for x in myresult:
ct1 = ct1 + 1
if (ct1 >0):
return ct1
# print("Login Sucessfully")
# import welcome
# welcome.vp_start_gui()
# end
Adminpanel.py
def adminpan():
while(True):
print(" Welcome to Railway Reservation System ")
print(" ----------------------------------------------------- ")
print("Enter 1. Feed Back Details Of Our Customer")
print("Enter 2. Customer Ticket Booking Deatils")
print("Enter 3. To Back")
try:
a=int(input("Select a choice from 1-3: "))
print()
#//==============================user=============================================
======
if(a==1):
import feedbackdetails
feedbackdetails.feedb()
#
//==================================admin=========================================
==========
if (a == 2):
import customerbookingdt_All
s = customerbookingdt_All.cust_all()
#
//================================register========================================
===============
elif(a==3):
import Main
break
#
//==============================exit==============================================
=============
else:
print("Please enter a valid choice from 1-4")
except ValueError:
print("Please input as suggested.")
adminpan()
feedbackdetails.py
import mysql.connector
def feedb():
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
# print(records)
import mysql.connector
def cust_all():
import mysql.connector
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)
mycursor = mydb.cursor()
print("---------------------------------------------------------------------------
----------------------------------------------------------------------------------
------------------------------------------------------")
cust_all()
BIBLIOGRAPHY
➢ https://www.google.com
➢ https://stackoverflow.com
➢ https://docs.python.org/3/
➢ Computer Science with Python by Sumita Arora
➢ https://www.tutorialspoint.com/python/