Railway

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

PROJECT REPORT

ON

MODERN INTERNATIONAL SCHOOL


Sector-19, Dwarka, New Delhi, Delhi 110075

UNDER THE GUIDANCE SUBMITTED BY


MRS MANU ASHMIT
(SUBJECT TEACHER: COMPUTER SCIENCE) ROLL NO:
Acknowledgement

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

Teacher’s sign. Principal’s sign.

____________. _____________
INDEX

S.No. TABLE OF CONTENT Sign.

1. CERTIFICATE

2. ACKNOWLEDGEMENT

3. INTRODUCTION

4. HARDWARE AND

SOFTWARE REQUIREMENTS

5. OUTPUT & CODING PROJECT

6. CONCLUSTION
INTRODUCTION

Railway Reservation System is performance of Ticket Booking. This software is maintaining


the details of Train and details of Passenger with Traveling details.

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

Processor : Pentium IV 630MHz

RAM : 4 GB

Hard Disk : 500 GB

Monitor : 15” Color monitor

Key Board : 122 Keys

SOFTWARE CONFIGURATION

Operating System : Windows 10.

Language : Python 3.8.6

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

nm = input("Enter User Name: ")


pa = input("Enter User Password: ")
emid = input("Enter User Email Id: ")
mobb = input("Enter User Mobile: ")
import newreg
newreg.newregister(nm,pa,emid,mobb)
print("Record Inserted.")
#
//==============================exit==============================================
=============

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

def newregister(a, b, c, d):


ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)

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

def logindt(a, b):


ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)

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

nm = input("Enter User Name: ")


emid = input("Enter User Email Id: ")
mobb = input("Enter User Mobile: ")
fd = input("Enter Feed Back Details: ")
import FeedBack

FeedBack.feedback(nm, emid, mobb,fd)


print("Record Inserted.")

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

print("Railway Reservation System is performance of Ticket Booking. \n"


"This software is maintaining the details of Train and details of \n"
"Passenger with Traveling details.\n"
"This software also maintains Railway Reservation, Cancellation, Waiting
Listing,\n"
"and Passenger Information etc.\n"
"This program is capable of holding any number of Train Record and
Reservation Records.\n"
"The object of this project is to monitor the performance of Railway Ticket
Reservation.\n"
"The performance of Railway Reservation will be monitored by Reservation/
Cancellation.\n"
"Fair will calculate according to the distance of journey\n")
trainlist.py

import mysql.connector

mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)

mycursor = mydb.cursor()

mycursor.execute("select * from train")


records = mycursor.fetchall()

line_new = f'{"Train No.":>2} {"TRAIN NAME":>20} {"FORM":>20} {"TO":>20}


{"TIME":>20} {"DAY":>20}'
print(line_new)
print("---------------------------------------------------------------------------
------------------------------------------------")

for row in records:


line_new = f'{row[0]:>2} {row[1]:>20} {row[2]:>20} {row[3]:>20}
{row[4]:>20} {row[5]:>20}'
print(line_new)

print("---------------------------------------------------------------------------
--------------------------------------------------")
Booking.py

import random

import mysql.connector
from array import array

# for new register

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)

mycursor.execute("select * from trainbooking where bookingid='" + a1 + "'")


records = mycursor.fetchall()

for row in records:

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

sql = "DELETE FROM trainbooking WHERE bookingid='" + a + "'"


mycursor.execute(sql)
mydb.commit()

# end
feebcak.py

import mysql.connector
# for new register

def feedback(a, b, c, d):


ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)

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

def logindt(a, b):


ct1 = 0
mydb = mysql.connector.connect(
host="localhost",
user="root",
passwd="1234",
database="railway_python"
)

mycursor = mydb.cursor()

mycursor.execute("SELECT * FROM admin 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
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()

mycursor.execute("select * from feedback")


records = mycursor.fetchall()

# print(records)

print("NAME.\t\t EMAIL ID \t\t MOBILE NUMBER\t\tFEED BACK")


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

for row in records:


print(row[0], '|', " \t", row[1], '|', " \t\t", row[2],"| \t", row[3])
bookingdetail_All.py

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

mycursor.execute("select * from trainbooking")


records = mycursor.fetchall()

line_new = f'{"BOOKING ID.":>2} {"NAME":>6} {"EMAIL ID":>6} {"MOBILE NO":>6}


{"TRAIN NO":>6} {"FROM":>6} {"TO":>6} {"1. NON AC & 2. AC":>6} {"NO OF
SEAT":>11} {"TOTAL AMOUNT":>11} {"DATE":>9}'
print(line_new)
print("---------------------------------------------------------------------------
----------------------------------------------------------------------------------
------------------------------------------------------")
#print(records)
for row in records:
line_new = f'{row[0]:>2} {row[1]:>10} {row[2]:>10} {row[3]:>10}
{row[4]:>10} {row[5]:>10} {row[6]:>10} {row[7]:>10} {row[8]:>10}
{row[9]:>10} {row[10]:>10} '
print(line_new)

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/

You might also like