0% found this document useful (0 votes)
26 views32 pages

Cs 12

Uploaded by

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

Cs 12

Uploaded by

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

COMPUTER SCIENCE PROJECT

RAILWAY RESERVATION
SYSTEM
“The train is a small world moving through a larger world.”

Done by:
POUNAMI ROY

1
(Panisagar, North Tripura - 799260)

COMPUTER SCIENCE
Certified to be the Bonafide Record of work done by POUNAMI ROY
of Std XII in the Computer Science Lab of PM SHRI KENDRIYA
VIDYALAYA PANISAGAR, NORTH TRIPURA, during the year 2024 –
20225

Date: Teacher-in-charge

REGISTER NO. ____________________

Submitted for All India Senior Secondary Practical Examination in

Computer Science held on ______________________________at

PM SHRI Kendriya Vidyalaya Panisagar.

Principal Internal Examiner External Examiner

2
ACKNOWLEDGEMENT

I would like to express my sincere thanks to our Principal

Mr. Sanu Tripathi for their encouragement and support to

work on this Project. I am grateful to my computer science

teacher Ms. Sheetal Kamble and to the computer science

department teachers, lab teachers for the constant guidance

and support to complete the project.

Also I would like to thank my parents, family members and

friends who helped me to complete this project successfully.

3
TABLE OF CONTENT

1. OVERVIEW OF PYTHON AND ITS VARIOUS OBJECTS


2. PROJECT DESCRIPTION
3. FUCNTIONS USED
4. SOURCE CODE
5. SAMPLE OUTPUT
6. CONCLUSION
7. BIBLIOGRAPHY

4
1.OVERVIEW OF PYTHON AND ITS
VARIOUS OBJECTS

Python is an interpreted, object-oriented, high-level programming


language with dynamic semantics. Its high-level built in data structures,
combined with dynamic typing and dynamic binding, make it very attractive for
Rapid Application Development, as well as for use as a scripting or glue
language to connect existing components together. Python's simple, easy to
learn syntax emphasizes readability and therefore reduces the cost of program
maintenance. Python supports modules and packages, which encourages
program modularity and code reuse. The Python interpreter and the extensive
standard library are available in source or binary form without charge for all
major platforms, and can be freely distributed.
Somewhat more formally, in Python, data takes the form of objects
—either built-in objects that Python provides, or objects we create using Python
or external language tools such as C extension libraries. Although we’ll firm up
this definition later, objects are essentially just pieces of memory, with values
and sets of associated operations.
1. Programs are composed of modules.
2. Modules contain statements.
3. Statements contain expressions.
4. Expressions creates and process objects
5. Built-in objects make programs easy to write. For simple tasks, built-in
types are often all you need to represent the structure of problem domains.
Because you get powerful tools such as collections (lists) and search tables
(dictionaries) for free, you can use them immediately. You can get a lot of
work done with Python’s built-in object types alone.

5
6. Built-in objects are components of extensions. For more complex tasks,
you still may need to provide your own objects, using Python classes or C
language interfaces. But as you’ll see in later parts of this book, objects
implemented manually are often built on top of built-in types such as lists
and dictionaries. For instance, a stack data structure may be implemented as
a class that manages or customizes a built-in list.
7. Built-in objects are often more efficient than custom data structures.
Python’s built-in types employ already optimized data structure algorithms
that are implemented in C for speed. Although you can write similar object
types on your own, you’ll usually be hard-pressed to get the level of
performance built-in object types provide.
8. Built-in objects are a standard part of the language. In some ways,
Python borrows both from languages that rely on built-in tools (e.g., LISP)
and languages that rely on the programmer to provide tool implementations
or frameworks of their own (e.g., C++). Although you can implement unique
object types in Python, you don’t need to do so just to get started. Moreover,
because Python’s built-ins are standard, they’re always the same; proprietary
frameworks, on the other hand, tend to differ from site to site.
9. Easy-to-learn − Python has few keywords, simple structure, and a clearly
defined syntax. This allows the student to pick up the language quickly.
10.Easy-to-read − Python code is more clearly defined and visible to the eyes.
11.Easy-to-maintain − Python's source code is fairly easy-to-maintain.
12.A broad standard library − Python's bulk of the library is very portable
and cross-platform compatible on UNIX, Windows, and Macintosh.
13.Interactive Mode − Python has support for an interactive mode which
allows interactive testing and debugging of snippets of code.
14.Portable − Python can run on a wide variety of hardware platforms and has
the same interface on all platforms.

6
15.Extendable − You can add low-level modules to the Python interpreter.
These modules enable programmers to add to or customize their tools to be
more efficient.
16.Databases − Python provides interfaces to all major commercial databases.
17.GUI Programming − Python supports GUI applications that can be created
and ported to many system calls, libraries and windows systems, such as
Windows MFC, Macintosh, and the X Window system of Unix.
18.Scalable − Python provides a better structure and support for large programs
than shell scripting.

Python too supports file handling and allows users to handle files
i.e., to read and write files, along with many other file handling options, to
operate on files. The concept of file handling has stretched over various other
languages, but the implementation is either complicated or lengthy, but alike
other concepts of Python, this concept here is also easy and short. Python treats
file differently as text or binary and this is important. Each line of code includes
a sequence of characters and they form text file. Each line of a file is terminated
with a special character, called the EOL or End of Line characters like comma
{,} or newline character. It ends the current line and tells the interpreter a new
one has begun. Let’s start with Reading and Writing files. There are also
various other functions that help to manipulate the files and its contents. One
can explore various other functions in Python Docs.

7
2.PROJECT DESCRIPTION

Scope of the project


The railway reservation system system is basically a database based project

done with help of python language. This project is very use full for the people to book or

cancel train tickets by sitting at home with one cell phone in their hand. This project can be

modified for various reservations.

Functional Features
1. The objective of this project is to let the students apply the programming
knowledge into a real- world situation/problem and exposed the students
how programming skills helps in developing a good software.
2. Write programs utilizing modern software tools.
3. Apply object oriented programming principles effectively when
developing small to medium sized projects.
4. Write effective procedural code to solve small to medium sized
problems.
5. Students will demonstrate a breadth of knowledge in computer science,
as exemplified in the areas of systems, theory and software development.
6. Students will demonstrate ability to conduct a research or applied
Computer Science project, requiring writing and presentation skills
which exemplify scholarly style in computer science.
Technology Used:
• Windows OS
• Python
• mysql connector modulle
• CSV file for storing data

8
3.FUCNTIONS USED

defmenu(): This function lets the user go to the


anonymous landing page

defmain(): This function lets the user to know


the activities which he or she can
perform in the program

defticket_booking(): This function lets the user to book the


ticket with his/her credentials

defticket_checking(): This function lets the ticket reserved


user to check the details with the help
of phone number

defticket_cancelling(): This function let’s the ticket reserved


user to cancel the reserved ticket

defchecking(): This function takesthe user to sign in


page

defchecking_1(): This function takes the user to sign up


page

9
defchecking_2(): This function takes the user to delete
account page

defchecking_3(): This function helps the user to check


his/her own account details

3.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),phnovarchar(15)
primary key,ageint(4),gender
varchar(50),from_fvarchar(100),
to_t varchar(100),date_dvarchar(20))"

cursor.execute(s1)

s1="create table user_accounts(fname


varchar(100),lnamevarchar(100),user_name
varchar(100) ,password varchar(100) primary
key, phnovarchar(15),gender varchar(50),dob
varchar(50),age varchar(4))"

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

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

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

13
to=input('enter your destination:')
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,agev,
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 phnone number:'))
try:
s1="select * from railwaywherephno=phno"
cursor.execute(s1)
data=cursor.fetchall()[0]

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

15
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

16
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_accountswhere
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

17
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')

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

19
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

20
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])

21
print(x[5],':::',data[5])
else:
return False
except:
print('ACCOUNT DOES NOT EXIST')
menu()
5.SAMPLE OUTPUT

CHOICE WINDOW

IF CHOICE IS 1(LOGIN WINDOW)

22
IF CHOICE IS2(SIGN UP WINDOW)

23
IF CHOICE IS3(DELETE ACCOUNT)

24
IF CHOICE IS4(EXIT)

IF CHOICE IS5 OR MORE

25
SECOND CHOICE LIST AFTER LOGIN

IF CHOICE IS1(TICKET BOOKING)

26
IF CHOICE IS2(TICKET CHECKING)

27
IF CHOICE IS3(TICKET CANCELLING)

28
IF CHOICE IS4(ACCOUNT DETAILS)

IF CHOICE IS5(LOG OUT)

29
IF CHOICE IS5 OR MORE

6. CONCLUSION
30
The main of developing reservation system is to provide all information
that is required by the users.

User friendliness is a must that is the user must get the details without
complicated searching procedures .

Other important requirements of software are data security, extensibility and


maintainability.

31
7.BIBLIOGRAPHY

• Computer science With Python - Class XI By : Sumita Arora


• https://www.google.com
• https://www.wikipedia.org
• Website: https://www.w3resource.com

32

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy