Project On Train Reservation Project Report IN CO MP UT ER SCI EN CE FO R CL AS S XII (2023-2024)
Project On Train Reservation Project Report IN CO MP UT ER SCI EN CE FO R CL AS S XII (2023-2024)
PROJECT REPORT
IN
CO
MP
UT
ER
SCI
EN
CE
FO
R
CL
AS
S
XII
(2023-2024)
BY:SANTHOSH T.M.A
Enrollemnt no:
i
UNDER THE GUIDANCE O F
Mrs.C.KALAIMANI
ii
This is to certify
that this project
entitled "TRAIN
RESERVATION"
is a record
bonafide work
carried out by
SANTHOSH
T.M.A in
COMPUTER
SCIENCE
prescribed by
AKSHAYA
ACADEMY CBSE
SENIOR
SECONDARY SCHOOL, ODDANCHATRAM .
iii
ACKNOWLEDGEMENT
gave valuable suggestion and guidance for completing the project, also
parents and my
iv
TABLE OF CONTENTS
1 INTRODUCTION 1
3 PROJECT DESCRPTION 3
4 FLOWCHART 5
5 SOURCE CODE 7
6 OUTPUT SCREENSHOTS 12
7 CONCLUSION 22
8 BIBLIOGRAPHY 23
v
1. INTRODUCTION
OF THE
PROGRAM
1
02. HARDWARE
AND SOFTWARE
REQUIREMENTS
2.1 HARDWARE
REQUIREMENTS
2.2 SOFTWARE
REQUIREMENTS
I. WINDOWS OS
2
03. PROJECT
DESCRIPTION
• Relation model
• Hierarchical model
• Network model
RELATIONAL MODEL It’s based on the concept on relation. Relation
is the table that consists of rows and columns. The rows of the table
are called tuple and the columns of the table are called attribute.
Numbers of rows in the table is called as cardinality. Number of
columns in the table is called as degree.
HIERARCHICAL MODEL: In this type of model, we have multiple
records for each record. A particular record has one parent record.
3
No chide record can exist without parent record. In this, the records
are organized in tree (like structure
NETWORK MODEL:- In this, the data is represented by collection of
records and relationship is represented by (ink or association.
CHARACTERISTICS OF DB MS: -
• Data sharing
• Data standardization
DIFFERENT TYPES OF FILES: -BASED ON ACCESS:-
• Sequential file
• Serial file
• Text file
• Binary File
04. FLOWCHART
4
5
6
05. SOURCE CODE
import mysql.connector
import os import
platform #import
pandas as pd
#cs project by vijaya,vibin,vicky,tma :)
pnr=1024
mydb=mysql.connector.connect(host="localhost",user="root",passwd="root");
mycursor=mydb.cursor()
mycursor.execute("create database if not exists train") mycursor.execute("use
train") mycursor.execute("create table if not exists traindetail(tname
CHAR(50),tnum INT(6),src char(50),des char(50),ac1 int(5),ac2 int(5),ac3
int(5),slp int(5))") mycursor.execute("create table if not exists
passengers(pname char(20),age int(3),trainno int(6),noofpas int(3),cls
char(4),amt int(6),status char(10),pnrno int(6))") def railresmenu():
print("Railway Reservation ")
print("1.Train Detail") print("2.Reservation
of Ticket") print("3.Cancellation of
Ticket") print("4.Display PNR status")
print("5.Quit")
7
def traindetail():
print("Train Details")
ch='y'
while (ch=='y'):
l=[]
name=input("enter train name :")
l.append(name) tnum=int(input("enter train number
:")) l.append(tnum)
ac1=int(input("enter number of AC 1 class seats"))
l.append(ac1) ac2=int(input("enter number of AC 2
class seats")) l.append(ac2)
ac3=int(input("enter number of AC 3 class seats"))
l.append(ac3) slp=int(input("enter number of
sleeper class seats")) l.append(slp)
train=(l) sql="insert into
traindetail(tname,tnum,ac1,ac2,ac3,slp)values(%s,%s,%s,%s,%s,%s)"
mycursor.execute(sql,train)
mydb.commit()
print("insertion completed")
print("Do you want to insert more train Detail")
ch=input("enter yes/no") print('\n' *10)
print("====================================================
===============")
railresmenu() def
reservation():
global pnr
l1=[]
pname=input("enter passenger name=")
l1.append(pname)
age=input("enter age of passenger =")
l1.append(age)
trainno=input("enter train number")
l1.append(trainno)
8
np=int(input("Enter number of passanger:"))
l1.append(np)
print("select a class you would like to travel in")
print("1.AC FIRST CLASS")
print("2.AC SECOND CLASS")
print("3.AC THIRD CLASS")
print("4.SLEEPER CLASS")
cp=int(input("Enter your choice:"))
if(cp==1):
amount=np*1000
cls='ac1'
elif(cp==2):
amount=np*800
cls='ac2'
elif(cp==3):
amount=np*500
cls='ac3'
else:
amount=np*350
cls='slp'
l1.append(cls)
print("Total amount to be paid:",amount)
l1.append(amount) pnr=pnr+1
print("PNR Number:",pnr) print("status:
confirmed")
sts='conf'
l1.append(sts)
l1.append(pnr)
train1=(l1) sql="insert
into
passengers(pname,age,trainno,noofpas,cls,amt,status,pnrno)values(%s,%s,%s,%
s,%s,%s,%s,%s)"
mycursor.execute(sql,train1)
mydb.commit() print("insertion
completed") print("Go back to
menu")
9
print('\n' *10)
print("====================================================
===============")
railresmenu()
railresmenu() def cancel():
print("Ticket cancel window")
pnr=input("enter PNR for cancellation of Ticket")
pn=(pnr,)
sql="update passengers set status='deleted' where pnrno=%s"
mycursor.execute(sql,pn) mydb.commit()
print("Deletion completed") print("Go back to menu")
print('\n' *10)
print("====================================================
===============")
railresmenu()
railresmenu() def
displayPNR():
print("PNR STATUS window")
pnr=input("enter PNR NUMBER")
pn=(pnr,)
sql="select * from passengers where pnrno=%s"
mycursor.execute(sql,pn)
res=mycursor.fetchall() #mydb.commit()
print("PNR STATUS are as follows : ")
print("(pname,age,trainno, noofpas,cls,amt,status, pnrno)") for
x in res:
print(x)
#print("Deletion completed")
print("Go back to menu")
print('\n' *10)
10
print("====================================================
===============")
railresmenu()
railresmenu()
railresmenu()
11
06. OUTPUT
SCREENSHOTS
12
6.3 FOR ENTERING RESERVATION OF TICKETS
13
6.4 TO CANCEL TRAIN TICKETS
14
6.5 TO DISPLAY PNR STATUS
15
6.6 TICKET CONFIRM SCREEN
16
6.7 TO EXIT
17
6.8 DATABASE-RAIL
18
6.9 TABLE STRUCTURE 1
19
07. CONCLUSION
20
08. BIBLOGRAPHY
7.1 BOOKS
REFERED
7.2 WEBSITES
REFERED
I. WWW.W3SCHOOL.COM
II. WWW.GITHUB.COM
III. WWW.GOOGLE.COM
IV. HTTPS://CHAT.OPENAI.COM/
V.
WWW.PYTHON.COM
21