0% found this document useful (0 votes)
277 views31 pages

Computer Science Project For Class 12th

The document describes a railway reservation system project done using Python and a database. The system allows users to book, cancel, and check tickets online from their phones. It uses Python to connect to a MySQL database where reservation data is stored and retrieved. The system development life cycle and flowchart are also outlined, showing how users can sign in/up and fulfill reservation needs by interacting with the database via Python code. Source code snippets are included showing how tables are created and user functions work like booking, checking, and canceling tickets.

Uploaded by

Krrish Gehlot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
277 views31 pages

Computer Science Project For Class 12th

The document describes a railway reservation system project done using Python and a database. The system allows users to book, cancel, and check tickets online from their phones. It uses Python to connect to a MySQL database where reservation data is stored and retrieved. The system development life cycle and flowchart are also outlined, showing how users can sign in/up and fulfill reservation needs by interacting with the database via Python code. Source code snippets are included showing how tables are created and user functions work like booking, checking, and canceling tickets.

Uploaded by

Krrish Gehlot
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 31

RAILWAY RESERVATION

SYSTEM
INTRODUCTION-:
The railway reservation system is basically a
database project done with the help of python
language. This project is very useful. This project is
very useful for the people to book or cancel train
tickets by sitting at home with one cell phone in
their hand. This project can be verified for various
reservation.

OBJECTIVES:-
• It works on basic principle of linking python and a
database.
• At first, the command will be given in python
software afterwards the command will be sent to
the database.
• There in the database the command will fetch
the demanded data and it will give it to the
python software.
• Then the required output will be shown in python
software.
PROPOSED SYSTEM
Today one cannot afford to rely on the fallible human
beings of be really wants to stand against today’s
merciless competition where not to wise saying “to err
is human” no longer valid, it’s outdated to rationalize
your mistake. So, to keep pace with time, to bring
about the best result without malfunctioning and
greater efficiency so to replace the unending heaps of
flies with a much sophisticated hard disk of the
computer.

One has to use the data management software.


Software has been an ascent in atomization various
organizations. Many software products working are now
in markets, which have helped in making the
organizations work easier and efficiently. Data
management initially had to maintain a lot of ledgers
and a lot of paper work has to be done but now
software product on this organization has made their
work faster and easier. Now only this software has to
be loaded on the computer and work can be done.

This prevents a lot of time and money. The work


becomes fully automated and any information regarding
the organization can be obtained by clicking the button.
Moreover, now it’s an age of computers of and
automating such an organization gives the better look.
SYSTEM DEVELOPMENT LIFE CYCLE

The system development life cycle is a project


management life cycle is a project management technique divides complex project into smaller ,more easily managed segments or phases.

Software development project typically include initiation, planning, design, development, testing, implementation and maintenance phases.
FLOWCHART

PYTHON- MYSQL CONNECTING

SOFTWARE LOGIN WITH


USERNAME AND PASSWORD

ASKS USERS TO ENTER THEIR CHOICE

USER’S NEED WILL BE FULFILLED BY PYHTON


INTERACTING WITH MYSQL
i.e. registering- stored in database
getting information- get from database

AGAIN FIRST PAGE WILL BE OPENED TO


FULFIL THE NEED OF USER
SOURCE CODE
FILE NAME: TABLES
Import mysql.connector
mycon=mysql.connector.connect(host=‘localhost’,user=‘root’
,passwd=‘manager’)
cursor=mycon.cursor()
mycon.autocommit=True
s1=“create database railway”
cursor.execute(s1)
s1=“create table railway(name varchar(100),phno
varchar(15) primary key,age int(4),gender
varchar(50),from_f varchar(100),to_t
varchar(100),date_d varchar(20))”
cursor.execute(s1)
s1=“create table user_accounts(fname
varchar(100),lname varchar(100),user_name
varchar(100) ,password varchar(100) primary
key, phno varchar(15),gender
varchar(50),dob varchar(50),age
varchar(4))”
cursor.execute(s1)

FILE NAME: MAIN


def menu():
print(‘1.YES’)
print(‘2.NO’)
ch=int(input(‘DO YOU WANT TO CONTINUE OR NOT:’))
while ch==1:
print(‘WELECOME TO ONLINE RAILWAY RESERVATION
SYSTEM’)
print(‘1.SIGN IN’)
print(‘2.SIGN UP’)
print(‘3.DELETE ACCOUNT’)
print(‘4.EXIT’)
ch1=int(input(‘ENTER YOUR CHOICE:’))
if ch1==1:
a=checking()
if a==True:
print(‘WELCOME’)
main()
else:
continue
elif ch1==2:
a=checking_1()
if a==True:
main()
else:
print(‘PASSWORD ALREADY EXISTS’)
continue
elif ch1==3:
c=checking_2()
if c==True:
print(‘ACCOUNT DELETED’)
continue
else:
print(‘YOUR PASSWAORD OR USER_NAME IS INCORRECT’)
continue
elif ch1==4:
print(‘THANK YOU’)
break
else:
print('ERROR 404:PAGE NOT FOUND')
break
def main():
print('1.yes')
print('2.no')
c=int(input("do you want to continue or not:")
while (c==1):
print(' 1.TICKET BOOKING',"\n", '2.TICKET CHECKING',"\
n“ ,'3.TICKET CANCELLING’,"\n", '4.ACCOUNT DETAILS',"\n", '5.LOG
OUT')
ch=int(input('enter ur choice:'))
if ch==1:
ticket_booking()
elif ch==2:
ticket_checking()
elif ch==3:
ticket_cancelling()
elif ch==4:
checking_3()
elif ch==5:
print('THANK YOU')
break
else:
print('ERROR 404: ERROR PAGE NOT FOUND’)
def ticket_booking():
import mysql.connector
Mycon=mysql.connector.connect (host='localhost', User='root’,
passwd='manager', database='railway')
Cursor=mycon.cursor ()
mycon.autocommit=True
nm=input('enter your name:’)
phno=input('enter your phone number:’)
age=int(input('enter your age:’))
print(' M=MALE','\n’, 'F=FEMALE','\n’, 'N=NOT TO MENTION')
gender=input('enter your gender:’)
Gender=gender.upper()
fr=input('enter ur starting point:’)
date1=input('enter date(dd):’)
date2=input('enter month(mm):') date3=input('enter year(yyyy):’)
date=date1+"/"+date2+"/"+date3
a={'M':'MALE','F':'FEMALE','N':'NOT TO MENTION’}
v=a[Gender]
s1="insert into railway values ('{}',{},
{},'{}','{}','{}','{}')".format(nm,phno,age,v,fr,to,date)
cursor.execute(s1)
print('BOOKED SUCCESSFULLY’)

def ticket_checking():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root’,
passwd='manager',database='railway’)
cursor=mycon.cursor()
mycon.autocommit=True
print('1.yes’)
print('2.no’)
ch=int(input("do you want to continue or not:"))
if ch==1:
phno=int(input('enter your phone number:’))
try:
s1="select * from railway where phno=phno“
cursor.execute(s1)
data=cursor.fetchall()[0]
Data=list(data)
a=[‘NAME’,’PHONE,NUMBER’,’AGE’,’GENDER’,’STARTING
POINT’,’DESTINATION’,’DATE’,]
print(a[0],’::::’,Data[0].upper())
print(a[1],’::::’,Data[1])
print(a[2],’::::’,Data[2])
print(a[3],’::::’,Data[3].upper())
print(a[4],’::::’,Data[4].upper())
print(a[5],’::::’,Data[5].upper())
print(a[6],’::::’,Data[6])
except:
print(‘TICKET DOES NOT EXISTS’)
elif ch==2:
print(‘THANK YOU’)
else:
print(‘ERROR 404:PAGE NOT FOUND’)

def ticket_cancelling():
import mysql.connector
mycon=mysql.connector.connect(host=‘localhost’,user=‘root’,
passwd=‘manager’,database=‘railway’)
cursor=mycon.cursor()
mycon.autocommit=True
print(‘1.yes’)
print(‘2.no’)
ch=int(input(“do you want to continue or not:”))
if ch==1:
phno=input(‘enter your phone number:’)
s1=“delete from railway where phno=phno”
cursor.execute(s1)
print(‘TICKET CANCELLED’)
elif ch==2:
print(‘THANK YOU’)
else:
print(‘ERROR 404:PAGE NOT FOUND’)

def checking_2():
import mysql.connector
mycon=mysql.connector.connect(host=‘localhost’,user=‘root’,
passwd=‘manager’,database=‘railway’)
cursor=mycon.cursor()
mycon.autocommit=True
a=input(‘USER NAME:’)
b=input(‘PASS WORD:’)
try:
s1="select user_name from user_accounts where
password='{}'".format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
print('IS THIS YOUR ACCOUNT’)
s1="select user_name from user_accounts where
password='{}'".format(b)
c1="select fname,lname from user_accounts where
password='{}'".format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0]
data1=list(data1)
data1=data1[0]+' '+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
x=['FIRST NAME','LAST NAME','PHONE NUMBER’, 'GENDER’,
'DATE OF BIRTH’, 'AGE’]
s1="select fname, lname, phno, gender, dob, age from
user_accounts where password='{}'".format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
print(x[0],':::',data[0])
print(x[1],':::',data[1])
print(x[2],':::',data[2])
print(x[3],':::',data[3])
print(x[4],':::',data[4])
print(x[5],':::',data[5])
print(‘1.yes’)
print('2.no')
vi=int(input('enter your choice:’))
if vi==1:
b1="delete from user_accounts where password =
'{}'".format(b)
cursor.execute(b1)
return True
elif vi==2:
print('SORRY,RETRY’)
else:
print('ERROR 404:PAGE NOT FOUND’)
else:
return False
except:
print('ACCOUNT DOES NOT EXIST’)

def checking_1():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root’,
passwd='manager',database='railway’)
cursor=mycon.cursor()
mycon.autocommit=True
f=input("FIRST NAME:")
l=input("LAST NAME:")
a=input('USER NAME:’)
b=input('PASS WORD:’)
c=input('RE-ENTER YOUR PASS WORD:’)
ph=input(“PHONE NUMBER:”)
print(‘ M=MALE’,’\n’,’F=FEMALE’,’\n’,’N=NOT TO MENTION’)
gen=input(‘ENTER YOUR GENDER:’)
print(“ENTER YOR DATE OF BIRTH”)
d=input(“DD:”)
o=input(“MM:”)
p=input(“YYYY:”)
dob=d+’/’+o+’/’+p
age=input(‘YOUR AGE:’)
v={'m':'MALE','f':'FEMALE','n':'NOT TO MENTION’}
if b==c:
try:
c1="insert into user_accounts
values('{}','{}','{}','{}','{}','{}','{}','{}')".format(f,l,a,b,ph,v[gen],dob,age)
cursor.execute(c1)
print('WELCOME',f,l)
return True
except:
print('PASSWORD ALREADY EXISTS’)
return False
else:
print('BOTH PASSWORDS ARE NOT MATCHING’)

def checking():
import mysql.connector
mycon=mysql.connector.connect(host='localhost',user='root’,
passwd='manager',database='railway’)
cursor=mycon.cursor()
mycon.autocommit=True
a=input('USER NAME:’)
b=input('PASS WORD:’)
try:
s1="select user_name from user_accounts where
password='{}'".format(b)
c1="select fname,lname from user_accounts where
password='{}'".format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0] data1=list(data1)
data1=data1[0]+' '+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)[0]
if data==a:
print(' HII ',data1)
return True
else:
return False
except:
print(‘ACCOUNT DOES NOT EXIST’)

def checking_3():
import mysql.connector
mycon=mysql.connector.connect(host=‘localhost’,user=‘root’,
passwd=‘manager’,database=‘railway’)
cursor=mycon.cursor()
mycon.autocommit=True
a=input(‘USER NAME:’)
b=input(‘PASS WORD:’)
try:
s1=“select user_name from user_accounts where
password=‘{}’”.format(b)
c1=“select fname,lname from user_accounts where
password=‘{}’”.format(b)
cursor.execute(c1)
data1=cursor.fetchall()[0]
data1=list(data1)
data1=data1[0]+’ ‘+data1[1]
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
if data[0]==a:
x=[‘FIRST NAME’,’LAST NAME’,’PHONE NUMBER’,’GENDER’,’DATE
OF BIRTH’,’AGE’]
s1=“select fname,lname,phno,gender,dob,age from
user_accounts where password=‘{}’”.format(b)
cursor.execute(s1)
data=cursor.fetchall()[0]
data=list(data)
print(x[0],’:::’,data[0])
print(x[1],’:::’,data[1])
print(x[2],’:::’,data[2])
print(x[3],’:::’,data[3])
print(x[4],’:::’,data[4])
print(x[5],’:::’,data[5])
else:
return False
except:
print(‘ACCOUNT DOES NOT EXIST’)

menu()

OUTPUT
CHOICE WINDOW
IF CHOICE IS 1 (LOGIN WINDOW)
IF CHOICE IS 2 (SIGN UP WINDOW)
IF CHOICE IS 3 (DELETE ACCOUNT)
IF CHOICE IS 4 (EXIT)

IF CHOICE IS 5 OR MORE

SECOND CHOICE LIST AFTER LOGIN


IF CHOICE IS 1 (TICKET BOOKING)
IF CHOICE IS 2 (TICKET CHECKING)
IF CHOICE IS 3 (TICKET CANCELLING)

IF CHOICE IS 4 (ACCOUNT DETAILS)


IF CHOICE IS 5 (LOGOUT)

IF CHOICE IS 6 OR MORE
TESTING
Software testing methods are traditionally divided into black box testing
and white box testing. These two approaches are used to describe the
point of view that a test engineer takes when designing test cases.

BLACK BOX TESTING

Black box testing treats the software as a "black box," without any
knowledge of internal implementation. Black box testing methods
include: equivalence partitioning, boundary value analysis, all-pairs
testing, fuzz testing, model-based testing, traceability matrix,
exploratory testing and specification-based testing.

WHITE BOX TESTING

White box testing, by contrast to black box testing, is when the tester
has access to the internal data structures and algorithms (and the
code that implement these)

Types of white box testing:-


The following types of white box testing exist:
1. api testing – Testing of the application using Public and Private APIs.
2.Code coverage – creating tests to satisfy some criteria of code
coverage.
For example, the test designer can create tests to cause all statements
in the program to be executed at least once.
3. Fault injection methods.
4. Mutation testing methods.
5. Static testing – White box testing includes all static testing.
HARDWARE AND
SOFTWARE
REQUIREMENTS
BIBLIOGRAPHY
• Computer science with python

• https://www.w3resource.com

• https://www.wikipedia.org

• https://pythonmykvs.in

• https://pythonworld.in

• https://m.youtube.com

You might also like