0% found this document useful (0 votes)
8 views19 pages

druvcs

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

druvcs

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

PM SHRI KENDRIYA VIDYALAYA

No.2 VASCO DA GAMA, GOA

COMPUTER SCIENCE PROJECT


2024-25
CAR DEALER

SUMBITTED BY:-
NAME:- DRUV DHANANJAY KOTHARKAR
CLASS:- XII-A
CBSE ROLL NO:-

SUBMITTED TO:-
MR. NAVEEN KUMAR GHAVARI,
PGT(CS)
CERTIFICATE
This is to certify that, DRUV DHANANJAY
KOTHARKAR a student of class: XII-A of
PM SHRI KENDRIYA VIDAYALAYA NO.2
VASCO DA GAMA has successfully completed
the project on CAR DEALERSHIP
MANAGING MODEL under the supervision of
MR. NAVEEN KUMAR GHAVARI during the
year 2024-25 in fulfillment of Computer
Science project.

I certify this project up to my expectation and as per


guidelines issued by CBSE, NEW DELHI.

Signature of
INTERNAL

Signature of Signature of
PRINCIPAL EXTERNAL
ACKNOWLEDMENT

It is with pleasure that I acknowledge my


sincere gratitude to our teacher, MR. NAVEEN
KUMAR GHAVARI who taught and undertook
the responsibility of teaching the subject
computer science. I have been greatly
benefited from his classes.

I am especially indebted to our Principal Mr.


NARENDRA SINGH RATHORE who has always
been a source of encouragement and support
and without whose inspiration this project
would not have been a successful I would like
to place on record heartfelt thanks to him.
HARDWARES AND SOFTWARES
REQUIRED
HARDWARES
1. Desktop Computer/Laptop
2. Windows 10

SOFTWARES
1.Python
2.MySQL
3.Python MySQL Connector Module
(mysql.connector)
4.Python Prettytable Module (prettytable)
5.Python Getpass Module (getpass)
6.Python Keyboard Module (keyboard)
7.Python Sys Module (sys)
8.Visual Studio Code Application
CONTENTS
SL.NO TOPIC
1. Certificate
2. Acknowledgement
3. Hardware and
software required
4. Introduction
5. Python Source Code
6. MySQL Databases
7. Outputs
8. References
INTRODUCTION
The project CAR DEALERSHIP MANAGING
MODEL presented here represents a pivotal
solution to management of car models and their
specifications, blending the sophistication of MySQL
as the database backend with the dynamic
capabilities of Python.
Evolution Of Management Systems Using Python And
SQL Database
The evolution of management systems has witnessed a
paradigm shift with the advent of powerful programming
languages like Python and robust database management
systems such as MySQL. Python, recognized for its
simplicity, readability, and versatility, serves as the ideal
frontend language for developing user-friendly
interfaces. MySQL, on the other hand, provides a reliable
and scalable database solution, ensuring the secure
storage and retrieval of crucial information.
The integration of these technologies facilitates a
seamless flow of data. The dynamic connectivity offered
by the MySQL Python Connector ensures efficient
communication between the Python application and the
MySQL database.
Purpose Of The Car Models Managing
The Shopping Mall project aims to address several key
challenges in traditional managing quotation operations.
By leveraging Python's intuitive programming features
and MySQL's robust data management capabilities, the
system provides an agile and user-centric platform for
dealers.
Dealer Functions
•Add Model: Dealers can easily add new model by
providing essential details.
•Scrap Model: Dealers can easily scrap existing model by
confirming their action.
•Get Details: Dealers can easily get details of existing
models on the basis of fuel consumption, fuel type,
engine performance, price and wheel drive type .
•Update Model: Dealers can easily update existing model
by providing essential details.
•Search Model: Dealers can easily search a model by
providing essential details.
•Execute Custom SQL Query: Dealers can easily execute
custom DML SQL Qu
import mysql.connector
from prettytable import PrettyTable
from getpass import getpass as g
import keyboard
import sys
x=input("Enter Host Name For Database Or Default='localhost':").strip() or
'localhost'
y=input("Enter User Name For Database Or Default='root':").strip() or 'root'
a=g("Enter Password For Database:")
try:
m=mysql.connector.connect(host=x,user=y,password=a)
except Exception as e:
if isinstance(e,mysql.connector.errors.InterfaceError):
sys.exit("\n**********Please Install MySQL Server Before Using This
Software And Restart This Software************")
else:
print(e)
try:
b=input("\nEnter Host Name For Database Correctly Or
Default='localhost':").strip() or 'localhost'
c=input("Enter User Name For Database Correctly Or
Default='root':").strip() or 'root'
a=g("Enter Password For Database Correctly:")
m=mysql.connector.connect(host=b,user=c,password=a)
except Exception as e:
sys.exit("\n**********Please Check For Error :"+str(e)+" And Restart
This Software************")
mc=m.cursor()
dbn='car_model_dealer'
mc.execute("show databases;")
if (dbn,) not in mc.fetchall():
mc.execute("create database %s;"%dbn)
mc.execute("use %s;"%dbn)
mc.execute("create table car_model_(model_id varchar(3) primary key,
model_name varchar(100) not null,transmission_type varchar(200) not
null,fuel_type varchar(6) not null,wheel_drive_type varchar(3) not
null,performance int(10) not null,consumption int(10) not null,price int(20)
not null,constraint check(length(model_id)=3));")
m.commit()
else:
mc.execute("use %s;"%dbn)
def addnm():
try:
a= input("\nEnter Model Id (3 characters only) :")
b= input("\nEnter Model Name :")
c= input("\nEnter Transmission Type :")
d= input("\nEnter Fuel Type (diesel/petrol) :")
h= input("\nEnter Wheel Drive Type (awd/rwd/fwd/4wd) :")
e= int(input("\nEnter Performance In kw/h :"))
f= int(input("\nEnter Fuel Consumption in km/l :"))
g= int(input("\nEnter Price In Rs :"))
mc.execute("Insert into car_model_ values
(%r,%r,%r,%r,%r,%r,%r,%r)"%(a,b,c,d,h,e,f,g))
m.commit()
print("\nRecord Inserted")
except Exception as e :
print("\n****Operation Failed*****:",e)
def cl(a):
if a=='enter':
g(prompt=" ")
else:
keyboard.press_and_release("enter")
g(prompt=" ")
def dele():
a= input("\nEnter Model Id OR Nothing To Revert Your Deletion :")
try :
mc.execute("delete from car_model_ where model_id=%r;"%a)
m.commit()
print("\nScrapped Succesfully")
except Exception as e:
print("\n",e)
def showid():
mc.execute("select model_id,model_name from car_model_;")
t=PrettyTable(("Model Id","Model Name"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def show():
mc.execute("select * from car_model_;")
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def update():
try:
e=input("\nEnter Model Id For Updation :")
a=int(input("\nEnter New Engine Performance In kw/hr :"))
b=int(input("\nEnter New Fuel Consumption In km/l :"))
c=int(input("\nEnter New Price In Rs :"))
mc.execute("update car_model_ set performance=%r,consumption=%r,price=%r
where model_id=%r"%(a,b,c,e))
m.commit()
print("\nSuccesfully Updated Model With Model Id :%r"%(e))
except Exception as e:
print("\n",e)
def updtaeep():
try:
e=input("\nEnter Model Id For Updation :")
b=int(input("\nEnter New Engine Performance In kw/hr :"))
mc.execute("update car_model_ set performance=r where
model_id=%r"%(b,e))
m.commit()
print("\nSuccesfully Updated Model With Model Id :%r"%(e))
except Exception:
print("\n",e)
def updtaefp():
try:
e=input("\nEnter Model Id For Updation :")
b=int(input("\nEnter New Fuel Consumption In km/l :"))
mc.execute("update car_model_ set consumption=%r where
model_id=%r"%(b,e))
m.commit()
print("\nSuccesfully Updated Car Model With Model Id :%r"%(e))
except Exception as e:
print("\n",e)
def updtaep():
try:
e=input("\nEnter Model Id For Updation :")
b=int(input("\nEnter New Price In Rs :"))
mc.execute("update car_model_ set price=%r where model_id=%r"%(b,e))
m.commit()
print("\nSuccesfully Updated Model With Model Id :%r"%(e))
except Exception as e:
print("\n",e)
def showwd():
i=0
print("\nPress 'A' To Show All Wheel Drive Models\nPrint 'B To Show Four
Wheel Drive Models\nPrent 'C' To Show Front Wheel Drive Models\nPress 'D' To
Show Rear Wheel Drive Models\nPress 'E' To Show All Models Grouped On The
Basis Of Wheel Drive\n")
while True:
if keyboard.read_hotkey():
e=keyboard.read_key()
cl(e)
break
if e=="a":
mc.execute("select * from car_model_ where wheel_drive_type ='awd'
order by price asc;")
elif e=="b":
mc.execute("select * from car_model_ where wheel_drive_type ='4wd'
order by price asc;")
elif e=="c":
mc.execute("select * from car_model_ where wheel_drive_type ='fwd'
order by price asc;")
elif e=="d":
mc.execute("select * from car_model_ where wheel_drive_type ='rwd'
order by price asc;")
elif e=="e":
mc.execute("select * from car_model_ group by wheel_drve_type order by
price asc;")
else:
i=1
if i==1 :
print("\n*******Key Pressed Is Not Defined******\n")
showwd()
else:
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)

def showft():
i=0
print("\nPress 'A' To Show Diesel Models\nPress 'B' To Show Petrol
Models\nPress 'C' To Show All Models Grouped On The Basis Of Fuel Type\n")
while True:
if keyboard.read_hotkey():
e=keyboard.read_key()
cl(e)
break
if e=="a":
mc.execute("select * from car_model_ where fuel_type ='petrol' order by
price asc;")
elif e=="b":
mc.execute("select * from car_model_ where fuel_type ='diesel' order by
price asc;")
elif e=="e":
mc.execute("select * from car_model_ group by fuel_type order by price
asc;")
else:
i=1
if i==1 :
print("\n*******Key Pressed Is Not Defined******\n")
showft()
else:
t=PrettyTable(("Model Id","Model Name","TransmissionType","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def showp():
i=0
print("\nPress 'A' To Show All Models In The Ascending Order Of Engine
Perfromance\nPress 'B' To Show Models Of Engine Performance In A Given
Range\n")
while True:
if keyboard.read_hotkey():
a=keyboard.read_key()
cl(a)
break
if a=="a":
mc.execute("select * from car_model_ order by performance asc;")
elif a=="b":
e=int(input("\nEnter Lower Limit Of Range :"))
b=int(input("\nEnter Upper Limit Of Range :"))
mc.execute("select * from car_model_ where performance>=%i and
performance=<%i order by performance asc;"%(e,b))
else:
i=1
if i==1:
print("\n*******Key Pressed Is Not Defined******\n")
showp()
else:
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def showfp():
i=0
print("\nPress 'A' To Show All Models In The Ascending Order Of Fuel
Consumption\nPress 'B' To Show Models Of Fuel Consumption In A Given Range\n")
while True:
if keyboard.read_hotkey():
a=keyboard.read_key()
cl(a)
break
if a=="a":
mc.execute("select * from car_model_ order by consumption asc;")
elif a=="b":
e=int(input("\nEnter Lower Limit Of Range :"))
b=int(input("\nEnter Upper Limit Of Range :"))
mc.execute("select * from car_model_ where consumption>=%i and
consumption=<%i order by consumption asc;"%(e,b))
else:
i=1
if i==1:
print("\n*******Key Pressed Is Not Defined******\n")
showfp()
else:
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def showpr():
i=0
print("\nPress 'A' To Show All Models In The Ascending Order Of
Price\nPress 'B' To Show Models Of Price In A Given Range")
while True:
if keyboard.read_hotkey():
a=keyboard.read_key()
cl(a)
break
if a=="a":
mc.execute("select * from car_model_ order by price asc;")
elif a=="b":
e=int(input("\nEnter Lower Limit Of Range :"))
b=int(input("\nEnter Upper Limit Of Range :"))
mc.execute("select * from car_model_ where price>=%i and price=<%i
order by price asc;"%(e,b))
else:
i=1
if i==1:
print("\n*******Key Pressed Is Not Defined*********\n")
showpr()
else:
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
def search():
a=input("\nEnter Model Id :")
mc.execute("Select * from car_model_ where model_id=%r"%(a))
x=mc.fetchall()
if len(x)==0:
print("\nModel With Model Id :%r Not Found"%(a))
else:
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
t.add_row(x[0])
print(t)
def customquery():
a=input("\nEnter Query\n:>>")
try:
mc.execute(a)
t=PrettyTable(("Model Id","Model Name","Transmission Type","Fuel
Type","Wheel Drive Type","Performance In kw/hr","Fuel Consumption In
km/l","Price In Rs"))
for x in mc.fetchall():
t.add_row(x)
print(t)
except Exception as e:
print("\n********Error: "+str(e)+"***********")
def dbinfo():
print("\nName Of HostName: %r\nUserName: %r\nName Of
Database: %r\nName Of Table: %r"%(x,y,dbn,"car_model_"))
def delall():
print("\nConfirm Your Action\nPress 'N' For 'NO' OR Press 'Y' For
'YES'\n")
while True:
if keyboard.read_hotkey():
l=keyboard.read_key()
cl(l)
break
if l=='y':
mc.execute("delete from car_model_;")
m.commit()
print("Successfully Scrapped All Model")
elif l=='n':
print("Successfully Reverted Your Action")
def menu():
print("\nPress 'A' To Add New Model\nPress 'B' To Scrap A Model\nPress 'C'
To Show Model Id And Model Name Of All Models\nPress 'D' To Show Details Of
Models\nPress 'E' To Update A Model \nPress 'F' To Search A Model\nPress 'G'
To Execute A Custom MySQl Query \nPress 'H' To Scrap All Models\nPress 'I' To
Show Info Of Database\nPress 'J' To Exit\n")
menu()
while True:
print("\nPress 'K' To Display Menu\n")
try:
while True:
if keyboard.read_hotkey():
a=keyboard.read_key()
cl(a)
break
if a=='a':
addnm()
elif a=="b":
dele()
elif a=="c":
showid()
elif a=='d':
print("\n\nPress 'A' To Show All Models\nPress 'B' To Show Models On
The Basis Of Wheel Drive Type\nPress 'C' To Show Models On The Basis Of Fuel
Type\nPress 'D' To Show Models On The Basis Of Engine Performance\nPress 'E'
To Show Models On The Basis Of Fuel Consumption \nPress 'F' To Show Models On
The Basis Of Price\n")
while True:
if keyboard.read_hotkey():
e=keyboard.read_key()
cl(e)
break
if e=='a':
show()
elif e=='b':
showwd()
elif e=='c':
showft()
elif e=='d':
showp()
elif e=='e':
showfp()
elif e=='f':
showpr()
else:
print("\n*******Key Pressed Is Not Defined******\n")
elif a=='e':
print("\n\nPress 'A' To Update A Model(engine performance,price,fuel
consumption)\nPress 'B' To Update Engine Performance\nPress 'C' To Update
Fuel Consumption\nPress 'D' To Update Price\n")
while True:
if keyboard.read_hotkey():
l=keyboard.read_key()
cl(l)
break
if l=='a':
update()
elif l=='b':
updtaeep()
elif l=='c':
updtaefp()
elif l=='d':
updtaep()
else:
print("\n*******Key Pressed Is Not Defined******\n")
elif a=="f":
search()
elif a=="g":
customquery()
elif a=="k":
menu()
elif a=='h':
delall()
elif a=='i':
dbinfo()
elif a=='j':
print("\nThank You For Using Our Software")
break
else:
print("\n*******Key Pressed Is Not Defined******\n")
except Exception as e:
print("/n******Error: %r******"%str(e))
FOR UPDATING THE ADDRE

1.PYTHON

2.MY SQL

3.GeeksForGeeks

You might also like