0% found this document useful (0 votes)
30 views73 pages

Yashas Raju.m Grade 12 Ip

Uploaded by

Yashas Raju
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)
30 views73 pages

Yashas Raju.m Grade 12 Ip

Uploaded by

Yashas Raju
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/ 73

CBSE IP PROJECT

Car Dealership Management System

By
YASHAS RAJU.M

1
BRIGHT RIDERS SCHOOL
PROJECT REPORT 2021-22
CERTIFICATE

Certified that this is the bonafide record of the Project Work titled

____________________________________________________________

Done by

Name :
Roll Number :
Admission Number :

Class : XII Sci. During the year 2021-22

________________________

Teacher in Charge
(Informatics Practices Department)

______________ ____________
Examiner Principal

INDEX
SR.NO CONTENT PG.NO

2
1 ACKNOWLEDGMENT 4
2 SYSTEM 5
REQUIREMENT
3 PROJECT ABSTRACT 6
4 THEORITICAL 7-9
BACKGROUND
5 DATABASE DESIGN 10
6 CODING 11-27
7 OUTPUT 28-40
8 BIBLIOGRAPHY 41

3
Acknowledgement
I would like to express my special
thanks and gratitude to my teacher
Ms. for her support and guidance in
the project. I would like to thank
our principal Ms. Rachna Sharma
and our vice principals Ms.
Chitralekha P and Ms. Mridula
Tripathi for giving me this
opportunity to do this project on
the topic car managment.

4
PROJECT ABSTRACT
The car dealership management system refers to a data
management system that allows the user to store
information that you would find stored in the record of a
car dealership in a more simple, cost efficient and digital
manner. The car dealership management system helps to
create and maintain up-to-date information regarding the
car in the dealership on details such as its sales status,
ownership status, price, series no, vehicle type, etc and
other details to know about the vehicle stored in the
dealership. It contains all the info regarding a car and
allows us to keep the info updated and due to its simple
interface it can be used by any staff members who may or
may not have experience with computers to conveniently
manipulate, update or delete information regarding the
vehicle in the data provided in the system. There are also
other various fields that are present that make it
convenient for the person who is accessing the data such
as graphs and data analysis means that make it easier for
the people operating it to understand and perceive the
data in a simple and straight forward means.
6
THEORITICAL
BACKGROUND
PYTHON – FRONT END
What is Python?
Python is a popular programming language. It was created by
Guido van Rossum, and released in 1991.

It is used for:

• web development (server-side),


• software development,
• mathematics,
• system scripting.

What can Python do?


• Python can be used on a server to create web
applications.
• Python can be used alongside software to create
workflows.
• Python can connect to database systems. It can also read
and modify files.
• Python can be used to handle big data and perform
complex mathematics.
• Python can be used for rapid prototyping, or for
production-ready software development.

Why Python?
• Python works on different platforms (Windows, Mac,
Linux, Raspberry
Pi, etc).
• Python has a simple syntax similar to the English
language.
• Python has syntax that allows developers to write
programs with fewer lines than some other programming
languages.
• Python runs on an interpreter system, meaning that code
can be executed as soon as it is written. This means that
prototyping can be very quick.
• Python can be treated in a procedural way, an object-
orientated way or a functional way.

7
• In this tutorial Python will be written in a text editor. It is possible to
write Python in an Integrated Development Environment, such as
Thonny, Pycharm, Netbeans or Eclipse which are particularly useful
when managing larger collections of Python files

MYSQL – BACK END


MySQL, initially developed by MySQL AB, now backed by Oracle, is a relational
database management system (RDBMS), based on the client-server model. -
Data is distributed across, in a tabular form (in different tables) using rows and
columns.

MySQL Features

Relational Database Management System (RDBMS) MySQL is a relational


database management system. ...
Easy to use. MySQL is easy to use. ...
It is secure. MySQL consists of a solid data security layer that protects sensitive
data from intruders. ...
Client/ Server Architecture.
Free to download.
It is scalable.
Speed.
High Flexibility.

What is SQL?

• SQL stands for Structured Query Language

• SQL lets you access and manipulate databases
• SQL became a standard of the American National Standards Institute

(ANSI) in 1986, and of the International Organization for Standardization
(ISO) in 1987


8
What Can SQL do?
• SQL can execute queries against a database
• SQL can retrieve data from a database
• SQL can insert records in a database
• SQL can update records in a database
• SQL can delete records from a database
• SQL can create new databases
• SQL can create new tables in a database
• SQL can create stored procedures in a database
• SQL can create views in a database
• SQL can set permissions on tables, procedures, and views

RDBMS
RDBMS stands for Relational Database Management System.

RDBMS is the basis for SQL, and for all modern database systems such as
MS SQL Server, IBM DB2, Oracle, MySQL, and Microsoft Access.

The data in RDBMS is stored in database objects called tables. A table is a


collection of related data entries and it consists of columns and rows.

9
DATABASE DESIGN

10
CODING
Main Menu
import
mysql.connector
import pandas as pd
import menu1 import
menu2 import menu3
import menu4 import
menu5
print("""

------------------------------------------------------

|===================================================
===|
|======== *****MAIN MENU*****========|

|===================================================
===|
------------------------------------------------------

11
Enter 1 : EDIT MYSQL TABLE FROM PYTHON
Enter 2 : CREATE DATAFRAME FROM MYSQL TABLE
Enter 3 : CREATE DATAFRAME FROM CSV FILE
Enter 4 : DATAFRAME ANALYSIS
Enter 5 : GRAPHICAL ANALYSIS
Enter 6 : EXIT PROGRAM

""")
while(True):
ch=int(input("Enter your choice from the main menu:"))
if(ch==1):
print("call the function for
manipulation")
menu1.manipulation() if(ch==2):
print("call the function for creation of df
from table") menu2.mysqltodf()
if(ch==3):
print("call the function for creation of df
from csv") menu3.csvtodf() if(ch==4):
print("call the function for df
analysis") menu4.csvtodef()
if(ch==5):
print("call the function for graph
generation")
menu5.graphGenAnalysis() if(ch==6):
print("exit from the application")
break

12
Menu 1

def manipulation():
import mysql.connector
print("""

------------------------------------------------------

|===================================================
===|
|==============MANIPULATION OF RECORD ===============|

|===================================================
===|
----------------------------------------------
--------
Enter 1 : To Fill/Insert Information of vehicles table
Enter 2 : To Display Information of vehicles table
Enter 3 : To Delete Information from vehicles table
Enter 4 : To Update Information from vehicles table
Enter 5 : To Select a Row of Information from vehicles table
Enter 6 : To Alter the vehicles table
Enter 7 : To EXIT from the application """)
#creating the database

mydb=mysql.connector.connect(host="localhost",user="root",passwd="brightriders2
020#") mycursor=mydb.cursor()
mycursor.execute("create database if not exists
project") mycursor.execute("use project")
#creating required tables

13
mycursor.execute("create table if not exists VEHICLES(serial_no
INT(4),model_name varchar(50), model_year int(4), vehicle_type
varchar(35), sales_status varchar(20), manufactured_in varchar(20),
ownership_history varchar(20), last_maintenance varchar(10))")
mydb.commit()

while(True):
opt=int(input("ENTER YOUR
OPTION:")) if (opt==1):
print()
serial_no=int(input("ENTER SERIAL NUMBER OF THE VEHICLE:"))
print("""
""")
model_name=str(input("ENTER MODEL NAME:"))
print("""
""")
model_year=int(input("ENTER THE MODEL YEAR:"))
print("""
""")
vehicle_type=str(input("ENTER VEHICLE TYPE:"))
print("""
""")
sales_status=str(input("ENTER SALE STATUS:"))
print("""
""")
manufactured_in=str(input("ENTER COUNTRY OF MANUFACTURE:"))
print("""
""")
ownership_history=str(input("ENTER OWNERSHIP HISTORY:"))
print("""
""")

14
last_maintenance=str(input("ENTER LAST MAINTENANCE DATE:"))
print("""
""")
sql="INSERT INTO VEHICLES(serial_no, model_name, model_year,
vehicle_type, sales_status, manufactured_in, ownership_history,
last_maintenance) VALUES (%s,%s,%s,%s,%s,%s,%s,%s)"
val=(serial_no, model_name, model_year, vehicle_type,
sales_status, manufactured_in, ownership_history, last_maintenance)
mycursor.execute(sql,val) mydb.commit() print("DATA
ENTERED INTO SQL RECORD SUCCESSFULLY")
print("---------------------------------------------------------------------------
----------
-------------------------")
continue

if
(opt==2):
print()
mycursor.execute("select * from vehicles")
for i in mycursor: print(i)
print("THE INFORMATION HAS BEEN SUCCESSFULLY DISPLAYED")
print("---------------------------------------------------------------------------
----------
-----------------
--------")
continue
if (opt==3):
print("DATA BEFORE DELETION")
mycursor.execute("select * from vehicles")
for i in mycursor: print(i)
serial_no=int(input("ENTER THE SERIAL NUMBER WHOSE DATA
MUST BE DELETED:")) sql="delete from VEHICLES where
serial_no=%s"
15
#print(sql) val=(serial_no,)
#print(val) mycursor.execute(sql,val)
mydb.commit() print("DATA
DELETED SUCCESSFULLY")
print("TABLE AFTER DELETION")
mycursor.execute("select * from VEHICLES")
for i in mycursor:
print(i)
continue

if
(opt==4):
print("""

""")
print("TABLE BEFORE UPDATE")
mycursor.execute("select * from VEHICLES")
for i in mycursor:

print(i)
print("""
""")
serial_no=int(input("ENTER THE SERIAL NUMBER FOR THE UPDATE:"))
sales_status=str(input(("ENTER THE NEW SALES STATUS
OF THE VEHICLE:"))) sql="update vehicles set
sales_status=%s where serial_no=%s"
val=(sales_status,serial_no) mycursor.execute(sql,val)
mydb.commit() print("""
16
""")
print("DATA UPDATED
SUCCESSFULLY!") print("TABLE
AFTER UPDATE")
mycursor.execute("select * from vehicles")
for i in mycursor: print(i)
serial_no=input("PLEASE ENTER THE SERIAL NUMBER OF THE
VEHICLE TO VIEW THE DETAILS:") mycursor.execute("select *
from vehicles where serial_no="+serial_no)

for i in mycursor:
print(i)
continue

if
(opt==5):
print()
mycursor.execute("select * from vehicles")
for i in mycursor:
print(i)
print("""

""")
serial_no=str(input("ENTER THE SERIAL NUMBER OF THE
VEHICLE VIEW THE DETAILS:")) mycursor.execute("select * from
vehicles where serial_no="+serial_no) for i in mycursor:
print(i)
continue
17
if (opt==6):
print("****ALTER MENU****") print("1.
Add Column") print("2. Drop Column")
print("3. Exit Menu") while(True):
ch=int(input("CHOOSE AN OPTION FOR ALTER MENU:"))
if (ch==1):
print("TABLE BEFORE
ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
print("""
""")
COLUMN_NAME=input("ENTER THE COLUMN NAME:")
DATATYPE=input("ENTER DATATYPE:")
mycursor.execute("alter table vehicles add "+COLUMN_NAME+" "
+DATATYPE)
mydb.commit()
print("TABLE AFTER ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i) continue
if (ch==2):
print("TABLE BEFORE
ALTER")
mycursor.execute("desc vehicles")
for i in mycursor:
print(i)
print("""
""")
18
COLUMN_NAME=input("ENTER NAME OF COLUMN TO BE
DELETED:") mycursor.execute("alter table vehicles drop "
+COLUMN_NAME) mydb.commit() print("TABLE
AFTER ALTER") mycursor.execute("desc vehicles")
for i in mycursor:

print(i)
continue
if (ch==3):
print("Exiting to previous
menu...") break

if
(opt==7):
print("PROGRAM CLOSED")
break

19
Menu 2
def mysqltodf():
import pandas as pd
import sqlalchemy as
sq import
mysql.connector
print("""

-------------------------------------------------------------------

|===================================================
================|
|======== IMPORTING FROM MYSQL TO DF =========|

|===================================================
================|
--------------------------------------------------------------------

Enter 1 : IMPORTING DATA FROM MYSQL


TO DF Enter 2 : EXIT FROM THE
MENU""") while(True):
ch=int(input("Enter your choice:"))
if(ch==1):
print("IMPORTING DATA FROM MYSQL TO DF")

mydb=mysql.connector.connect(host="localhost",user="root",passwd="brightriders2
020#")

20
con=sq.create_engine("mysql+pymysql://root:brightriders2020#@localhost/project"
) df=pd.read_sql_query('SELECT * FROM
vehicles',con)
print(df)
print("Successfully importing the data")
continue
if(ch==2):
print("CLOSING PROGRAM...")
break

Menu 3
def csvtodf():
import pandas as pd df=pd.read_csv("car.csv") print("-
---------------EXTRACTING DATA FROM CSV----------------")
print(df)
print("DATAFRAME CREATED SUCCESSFULLY")

Menu4
def csvtodef():
import pandas as pd
import sqlalchemy as sq
import mysql.connector
df=pd.read_csv("car.csv")
print("""

Enter 1 : Returns the Top 5 Rows in the Dataset


Enter 2 : Returns Information of Dataframe
Enter 3 : Returns Last 5 Rows in the Dataset

21
Enter 4 : Grouping Vehicles Based on Sales Status
Enter 5 : Grouping Vehicles Based
on Ownership History Enter 6 :
Exit the Program""") while(True):
ch=int(input("Enter
your choice:"))
if(ch==1):

print("Returning the top


5 rows in the dataset")
df=pd.read_csv("car.csv")
print(df.head()) continue
if(ch==2):
print("Returning
information of dataframe")
print(df.info())
continue if(ch==3):
print("Returning last
5 rows of dataframe")
df=pd.read_csv("car.csv")
print(df.tail())
continue if (ch==4):
print("1.For
booked vehicles")
print("2.For Vehicles
for sale")
print("3.Exit this
menu")
while(True):
opt=int(input("ENTER AN
OPTION:")) if
(opt==1):

mydb=mysql.connector.connect(host="localhost",
user="root", passwd="brightriders2020#")
mycursor=mydb.cursor()
mycursor.execute("use project")
22
sql="select * from vehicles where
sales_status='booked'"
mycursor.execute(sql) for i in
mycursor: print(i)
mydb.commit() continue
if (opt==2):

mydb=mysql.connector.connect(host="localhost",
user="root", passwd="brightriders2020#")
mycursor=mydb.cursor()
mycursor.execute("use project")
sql="select * from vehicles where sales_status='for
sale'" mycursor.execute(sql)
for i in mycursor: print(i)
mydb.commit() continue if
(opt==3):

print("Redirecting to Main
Menu...")
break if (ch==5):
print("1.For
Second Hand
Vehicles")
print("2.For Pre-owned
Vehicles")
print("3.Exit this
Menu")
while(True):

opt=int(input("ENTER AN
OPTION:")) if
(opt==1):

mydb=mysql.connector.connect(host="localhost",
user="root", passwd="brightriders2020#")
mycursor=mydb.cursor()
mycursor.execute("use project")

23
sql="select * from vehicles where
ownership_history='second hand'" mycursor.execute(sql)
for i in mycursor: print(i) mydb.commit()
continue if (opt==2):
mydb=mysql.connector.connect(host="localhost",
user="root", passwd="brightriders2020#")
mycursor=mydb.cursor() mycursor.execute("use project")
sql="select * from vehicles where ownership_history='pre owned'"
mycursor.execute(sql) for i in mycursor:
print(i) mydb.commit() continue
if (opt==3):
print("Redirecting to Main
Menu...") break

if(ch==7):
print("EXITING THE PROGRAM")
break

Menu 5
def graphGenAnalysis():
import pandas as pd
import mysql.connector
import matplotlib.pyplot
as plt

24
import numpy as np
while(True):
print("option 1:Bar chart")
print("option 2:Pie chart")
print("option 3:Line chart")
print("option 4:Descriptive statistics")
print("option 5:Horizontal Bar graph")
print("option 6:Histogram")
print("option 7:exit")
ch=int(input("Enter your choice:")) if
ch==1:
df=pd.read_csv("car.csv")
df3=df.groupby(['vehicle_type']).count() print(df3)

df3.plot(kind='bar',y=df3.price.count(),color=["blue","green","yellow","red"])
plt.title('Car Dealership') plt.xlabel("Model Name")
plt.ylabel("Sales Status") plt.show() elif ch==2:
df=pd.read_csv("car.csv")
df3=df.groupby(['manufactured_in']).count()
y=df3['price'].tolist() carlabels=["CANADA","JAPAN","INDIA",
"USA"] plt.pie(y,autopct="%1.2f%%", labels=carlabels )
plt.legend()
plt.title("PIE CHART - VEHICLES MANUFACTURED IN EACH COUNTRY")
plt.show()

elif ch==3:
25
df=pd.read_csv("car.csv")
dfline=df.groupby('sales_status').count()
print(dfline)
y=dfline['price'].tolist() print(y)
x=['booked','for sale','out of stock']
print(x) print(y)

plt.plot(x,y,color="Blue",linestyle="dotted",marker="s",markersize=6,markeredgecol
or="red")

'''dfline.plot(kind="line",y=dfline.sales_status.count(),color="Blue",linestyle="dotted"
,

marker="s",markersize=6,markeredgecolor="red")'''
plt.title("Number of cars per sales status")
plt.xlabel("sales_status") plt.ylabel("Number of cars")
plt.show() elif ch==4:
df=pd.read_csv("car.csv")
res=df["price"].describe()
print(df)

plt.plot(res.index,res.values,color="m",marker="o",markersize=6,markeredgecolor=
"blue") plt.title("Descriptive
statistics for Price") plt.show()
elif ch==5:
df=pd.read_csv("car.csv")
df4=df.groupby(['vehicle_type'])
c=pd.DataFrame([df4['price'].sum()])

26
c.plot(kind='barh') plt.title("Horizontal Bar
graph Price in each Vehicle Type") plt.show()
elif ch==6:
df=pd.read_csv("car.csv")
data1=list(df.vehicle_type)

plt.hist(data1,bins=6,histtype="barstacked",align="mid",color="yellow",edgecolor="
m")
plt.title('Histogram - List of Vehicle
Types') plt.ylabel('Frequency of
Vehicle Type') plt.xlabel('Vehicle
Type') plt.show() elif ch==7:
break
else:
print("Invalid Choice")
continue

27
OUTPUT :
Main menu

61
Menu 1

62
63
64
Menu 2

65
Menu 3

Menu 4

66
67
68
Menu 5

69
70
71
72
BIBLIOGRAPHY
Sumita arora textbook class 12
http://python.mykvs.in/index.php
NCERT IP textbook
https://python4csip.com

73

You might also like