Cs Vicky Proj

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

PROJECT ON TRAIN RESERVATION

PROJECT REPORT
IN
COMPUTER SCIENCE FOR CLASS XII
(2023-2024)

A Project Report Submitted in Partial Fulfillment of


the Requirements

BY:VIGNESHWAR.M

Enrollemnt no:

UNDER THE GUIDANCE O F


Mrs.C.KALAIMANI

AKSHAYA ACADEMY CBSE SENIOR SECONDARY


SCHOOL,ODDANCHATRAM

i
AKSHAYA ACADEMY CBSE SENIOR SECONDARY
SCHOOL,ODDANCHATRAM
COMPUTER SCIENCE
2023-2024
BONAFIDE CERTIFICATE

This is to certify that this project entitled "TRAIN RESERVATION" is a


record bonafide work carried out by M.Vigneshwar in COMPUTER SCIENCE
prescribed by AKSHAYA ACADEMY CBSE SENIOR
SECONDARY SCHOOL, ODDANCHATRAM .

ROLL NO: DATE:

INTERNAL EXAMINER EXTERNAL EXAMINER PRINCIPAL

ii
ACKNOWLEDGEMENT

First I thank the Almighty for providing me everything that I required in

completing this project. I express my Gratitude to my principal

Mrs.R.Sowmya, My Headmaster Mr.A.Balaji and My Computer Science

Teacher Mrs.C.Kalaimani who guided me through the project and also gave

valuable suggestion and guidance for completing the project, also helped me

to understand the intricate involved in making the project. I would like to

extend my sincere thanks to all of them. I also thank my parents and my

friends who helped to complete the project successfully.

iii
TABLE OF CONTENTS

S.NO DESCRIPTION PAGE NO

1 INTRODUCTION 1

2 SOFTWARE AND HARDWARE


REQUIREMENTS 2

3 PROJECT DESCRPTION 3

4 FLOWCHART 5

5 SOURCE CODE 7

6 OUTPUT SCREENSHOTS 12

7 CONCLUSION 22

8 BIBLIOGRAPHY 23

iv
1. INTRODUCTION OF THE PROGRAM

No one can easily plan the journey comfortably as the process is


efficient and fast with being easy to access. Reservations can be made
through the Indian railways site or at the ample reservation centers
all over the country. Also now there are authorized agencies which
provide reservation facility on behalf of India railways and without
waiting in long line one can easily book a ticket. The booking is done
through an E- Ticket issue which has a PNR number of which one
has to take a print and just have to show at the station.
It not only provides reservation but cancellation can also be done
through this system at ease and one can use a credit card to complete
the process. This being a big step in terms of improvement in the
railway system it is widely accepted across the country.

1
02. HARDWARE AND SOFTWARE REQUIREMENTS

2.1 HARDWARE REQUIREMENTS

I. OPERATING SYSTEM:WINDOWS7 AND ABOVE

II. RAM : 521MB+

III. EXTERNAL STORAGE:(if any required)

IV. PRINTER :(if any required-hard copy)

2.2 SOFTWARE REQUIREMENTS

I. WINDOWS OS

II. PYTHON 3.7

III. MYSQL CONNECTOR 5.0

IV. MICROSOFT WORD

2
03. PROJECT DESCRIPTION

This is a project based on train reservation. The program helps us to


enter, display or alter the details of different trains.
Moreover & most importantly the program helps us to reserve or
cancel a train ticket.
The program also helps us to know the present status of a reserved
ticket, i.e. whether the ticket is confirmed or not.
It includes various function programs to do the above mentioned
tasks.
Data file handling has been effectively used in the program.
The database is a collection of interrelated data to serve multiple
applications. That is database programs create files of information.
So we see that files are worked with most, inside the program.
DBMS
The software required for the management of data is called as DBMS.
It has3 models
• 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: -
• It reduces the redundancy
• Reduction of data in inconsistency
• Data sharing
• Data standardization
DIFFERENT TYPES OF FILES: -BASED ON ACCESS:-
• Sequential file
• Serial file
• Random (direct access) file BASED ON STORAGE:-
• Text file
• Binary File

4
04. FLOWCHART

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

n=int(input("enter your choice"))


if(n==1):
traindetail()
elif(n==2):
reservation()
elif(n==3):
cancel()
elif(n==4):
displayPNR()
elif(n==5):
exit(0)
else:
7
print("wrong choice")

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=")
8
l1.append(pname)
age=input("enter age of passenger =")
l1.append(age)
trainno=input("enter train number")
l1.append(trainno)
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)"
9
mycursor.execute(sql,train1)
mydb.commit()
print("insertion completed")
print("Go back to menu")
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:
10
print(x)
#print("Deletion completed")
print("Go back to menu")
print('\n' *10)

print("====================================================
===============")
railresmenu()
railresmenu()

railresmenu()

11
06. OUTPUT SCREENSHOTS

6.1 MAIN SCREEN OF THE PROGRAM

12
6.2 FOR ENTERING TRAIN DETAILS

13
6.3 FOR ENTERING RESERVATION OF TICKETS

14
6.4 TO CANCEL TRAIN TICKETS

15
6.5 TO DISPLAY PNR STATUS

16
6.6 TICKET CONFIRM SCREEN

17
6.7 TO EXIT

18
6.8 DATABASE-RAIL

19
6.9 TABLE STRUCTURE 1

20
6.10 TABLE STRUCTURE 2

21
07. CONCLUSION

Also now there are authorized agencies which provide reservation


facility on behalf of India railways and without waiting in long line
one can easily book a ticket. The booking is done through an E-
Ticket issue which has a PNR number of which one has to take a
print and just have to show at the station.
It not only provides reservation but cancellation can also be done
through this system at ease and one can use a credit card to complete
the process. This being a big step in terms of improvement in the
railway system it is widely accepted across the country

22
08. BIBLOGRAPHY

7.1 BOOKS REFERED

SUMITA ARORA COMPUTER SCIENCE WITH PYTHON(XI & XII)

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

23
24

You might also like