You are on page 1of 11

DAV!

PUBLIC SCHOOL
1971-2020

DAVPUBLIC SCNDO,
CELEDRATING

ubllee
ONIT-VI. MUBAMESw
VEARS

WORK IS WORSHIP

SESSION:-2022-23

SUBJECT:COMEUTER SOIENCE
TOPIC: BUSLIST

SUBMITTED BY: GUIDED BY:


Name: SADHIKADAS NIHARIKA DASH

CLASS:XII, SEC:F PGT,COMP SC


CBSE ROLL NO:1as54413
Vaifad
BONAFIDE CERTIFICATE
This is to certify that SADHIKADAS of Class-XII,
Section-F has successfully completed the
project work entitled with "BUS LIST" under my
guidance during academic session 2022-23 for
the fulfillment of the requirement for AISSCE
Syllabus of the school.
All the works of the project was performed by
SADHIKA DAS. t is further certified that this
project is a group work of the students.

Ms. Niharika Dash

Date: S 23 PGT, Computer Science


External Examiner No:( 53|9s)
Name:

Signature:

01
ACKNOWLEDGEMENT
Iwish to express my sincere gratitude to my
Computer Science Teacher Ms. Niharika Dash
for her valuable guidance throughout the
course of this project work on "BUS LIST".
Then, Iwould also like to thank my principal
Ms. Ipsita Das for motivating to complete this
project. I am also thankful to other staffs,family
members andfriends, who rendered their help
during my project work within the stipulated
time period.
Thank you.
SawdbikaDe
Name:-SADHIKA DAS

Class:-XII, Section:-F
AISSCE Roll No:- lBG54H3

02
CONTENTS
SL. NO. CONTENTS PG. NO.

01 CERTIFICATE 01

02 ACKNOWLEDGEMENT

03 CONTENTS 03

04 INTRODUCTION Oy-05

05 CODES

06 OUTPUTS

07 BIBLIOGRAPHY 11

O3
INTRODUCTION
our day to day life we travel in bus not knowing the complex
programs which run behind our comnfortable journey nanaging
databases of all the buses enabling them to run without any
confusion and enabling us to board our buses with ease. Here I
have tried to represent the complex system of bus list
management using simple codes. My program contains the
following sub parts:
i)CREATING A RECORD

In this | have written a code enablingthe user to add the


details of any numberof the buses with ease.
i)DISPLAYING RECORD
It helps the user to display all the details of the buses
along with the details of the destination and distance to
be travelled.

ii)SEARCHING A RECORD
It enables the user to search a record in case he/she
wants to check whether the record is present in the list.It
alsoshows thedetails of the searched item if it is present
in the list.
iv)UPDATING ARECORD
it helps the user to update a record in case a wrong input
has
heen provided at the time of entering the
record.
v)DELETING ARECORD
It helps the user to delete the record in case any record is not
needed. Doing so simplifies the list of data leading to easy and
faster access to data.

vi)EXIT APROGRAM
It will help the user to exit the program.

O5
CODE SCREENSHOTS
Heln
Options Window
Fomat Run
/ : t tmysql.connector
nerE sys
mysql.connectori011 Error
itt
Destination, Departure_date, Distance]
(BusNO
createlB():
pe mydb=nysql.connector. connectl
thost="iocalihost ", user="I0t", passWd="1224567")
mvCursor-mydb.cursor()
mycursor.eexecute("create database BUsIist")
mydb.coAMit()
mycursor.close()
mydb.close()

createTable() :
mydb-iysql..connector.connectc(host="Iocalhost",
user="root",\
passwd="1234567
mycursor=mydb.cursor ()
database="Sueiist")
uCUT50r. execute("create tar student ()
BusNo int (5) prinary key, \
Destination varchar (35),\
Departure date date, Iistance varchar(25))")
mycurs0r. ccmmit()
nycursor.close ()
mydb. close ()

jdei BusNo Search () :

# Type here to search

X
e'untitled"
Fle Edit Format Run Options Window Help

d: BusNO Search ():


mydb=mysql . connector.connect (host="localhost", user='rzot,
passwd='1224567', database=BUsLit')
cursor-mydb.cursor ()
A=int (input ("Enter BuNo to searh: "))
sql="seleot fron student Nhere BusNo =".format (A)
$sql="select * from student where BusNo ="+str (A)
Cursor.execute (sql)
f0r roW in cursor:
print (row)
cursor.close ()
mydb.close ()

det DistanceSearch () :
ayab=nySql.connector.connect (host=localhost", user='root',\
passwd=1234567', database='EDEList )
cursor=nydb. cursor ()
S=input(Ent=r Distance to search: ")
Sql="elect * fyom student where pistance=[]'".format (s)
(')
q=select * fron student where Distance="+str('\")+S+str
cursor.execute (sql)
data=cursor.fetchall()
io ro in data:
prìnt (row)
cursor. close ()
Nydb.close ()
Dep dateSearch ():
ysql.connector. connect thost=°l:calhost", user= IO
passwd=1234567, database=gis1is')
Ln 166 Cck
PM
X
untatled Hel
Options Window
e f Format Run
dateSearch() :
idet Dep
mydb-mysq1..connector.connect (host="lccaihost", user='Ioot',\
passwd='1234567" , database='prsiist')
Cursor-mydb.cursor()
5ql="select * from student where Departure date like '2022-
Cursor.execute (sql)
cursor:
fox r o 1n
print(row)
cursor.close()
nydb.close()

det Insert():
nydb-nysql.connector. connectc(host="localhost",
user="root", \
cursor=mydb. cursor ()
passwd="1234567", database="BUsList")
BusNo =int (input ("'BusNo No: "))
Destination=input ("Iestination: ")
neparture date=input ("Departure_date (yyyy-A-dd): ")
Distance-input ("Distance: ")
sql="insert into student values
,'0,"O}".format (BusNo_, Destination, Departure date, Distance)
Cursor.execute (sql)
mydb.comnit ()
Cursor. close ()
nydb.close ()

def Delete () :
mydb=nysq1.connector.connect (host="localhost", user=' root',\ Actvate Wndows
nnn1
passwd=' 1234567' , database='BUSList')

Type here to search 22C. Haze

A untled'"
Fie Efa Format Run Options indow Help
der Delete ():
nydb=nysql.connector.connect (host="localhost", user='root',\
passwd='1234567', database='BUsList')
cursor-mydb.cursor ()
A=int (input ("Enter BusNo No to delete: "))
sql="aelete from student where BusNo_-{|". fomat (a)
Cursor.execute (sql)
mydb. commit ()
Cursor.close ()
mydb.close ()

def Modi£y():
ayab=mysql.connector.connect (host="localèost"iser='root',\
passwd='1234567', database='BUSList')
cursor-mydb. cursor()
4F1nt (input ("Enter BusNo to update record: ")
I=1nput ("Enter correct Destination: ")
sq="update student set estinati on=' ()! where BusNo ={}".format (N, A)
Cursor.execute (sql)
ydb. commit ()
cursor.close ()
aydb.close ()

dat Display ):
try:
d =ysql.connector.connect (host=locaIhcst',\
database='BUslist', user='root', password='1234567')
1f db.is connected(): Activate ndos
PIint ('Connected to MySQ database')
Ln: 156 Cok 0

57PM
De
Optone Window Help
Run
F.fo
Display()
:
X
Tysql i Connector..connect (host=
db database==EUSlist', user='root',
db.is connected(): localhost',
passwOrd=1234567)
print( Connected to MySQi
Error as
e: database!)
exoent
print(e)

$sys.exit() ->to kill program execution


pysql=db.cursor()
pysql.execute
e("select * ron student ")
data-pysql. fetchall()
data:
rOW n
f: print (row)
pysql.close()
db.close()

createDB()
createTable()
(4) :
i i range
tor Insert )
choice=]
shiie choice!e5:
Choice:-)
DLint ("Enter yOur
Drint ("1 . Search Record")
Drint ("2. DxeleLe Record")
nrint ("3. MO£ify Recora")
print ("4 . Display")
print ("5. Exit")

# Type here to search

"untted"
REa Format Run Opticns Window Helo

siie choice!=5:
print ("Enter your choice: -")
print ("1. Search Record")
print ("2. Delete Record")
print ("3. Modify Record")
print ("1. Display")
print ("5. xit")
choice=int (input ("Enter your choice:-"))
1f choice==1:
print ('sEARCA PROCESS STARTS NOW:-)
print(' l, Search by BuSNo : )
print (' 2. Search by Distance')
print (' 3. Search by Dep date')
op=int (input (' Bnter your choice:-))
1f op==l:
BusNo Search ()
elif op==2:
elifDistanceSearch()
op==3:
Dep dateSearch ()
else:
Print ( Invalid option entered)
1f choice==2:
Delete ()
Elif choice==3:
l1fModify ()
choice==4:
Display i)
int(Thanik yon) Ln: 166

59 PM
OUTPUT SCREENSHOTS
Cuit
Shell Debug Optians Virdun elp
Pythc 3.10-1 (tags/vi.L0.1:2ed268, Dec 20214 19:10:37 M8C

RESsTARE : C:/Users /HE /AppData/Local /PLogr KNS/Eyton/Ythor


7095

rtaeYSNYn2022-12-11

eat Bodgaya
sk L 2022-12-14
392km

Turi
teSYY 3022-12-29
E6X
3962
pesa Saralpu

40E

ch 9096
Enter

eceEd: 7095
on Sundergarh
nter
Shelt exo Options Windo Het

eAatC Bura

3962

-5

You might also like