This Python project implements a Car Showroom Management System using MySQL as the backend database. The system allows for operations such as adding new cars, managing employee details, sorting and filtering the car list, and contacting the showroom. This system can be accessed in two modes: Admin and Customer.
-
Admin View:
- Add, remove, and manage cars in the showroom.
- Manage employee details, such as adding new employees, changing salaries, and updating positions.
- Sort and filter cars based on various parameters such as price, year of production, or type.
- Admin authentication using a simple password system.
-
Customer View:
- View a list of available cars.
- Sort and filter cars to help find specific vehicles.
- Contact the showroom via phone, email, or by visiting the physical location.
Before running this project, you need to have the following installed on your system:
- Python 3.x: Make sure you have Python installed. You can download it from the official Python website.
- MySQL: Install and set up MySQL. You can download it from MySQL website.
- MySQL Connector for Python: Install this connector to enable communication between Python and MySQL. You can install it using the following command:
pip install mysql-connector-python
Clone this repository to your local machine or download the zip file and extract it.
git clone https://github.com/your-username/car-showroom-management.git
- Open your MySQL client and create the required database and tables.
- For the
Project
database, you can create tables likeEmployees
andCars
with appropriate columns.
CREATE DATABASE Project;
USE Project;
CREATE TABLE Employees (
CODE INT PRIMARY KEY,
Position VARCHAR(50),
Name VARCHAR(100),
Salary INT,
Joining_Date DATE
);
CREATE TABLE Cars (
CODE INT PRIMARY KEY,
Name VARCHAR(100),
Year INT,
Type VARCHAR(50),
Company VARCHAR(100),
Price INT,
Stock INT,
Color VARCHAR(50)
);
Modify the following lines in your Python script to match your MySQL configuration.
mycon = mysql.connector.connect(
host='localhost',
user='root',
passwd='YourPasswordHere',
database='Project'
)
Replace the following details:
host
: The hostname where MySQL is running (default:'localhost'
).user
: The username to connect to the database (default:'root'
).passwd
: The password for your MySQL user.database
: The name of your database (e.g.,Project
).
Once everything is set up, you can run the script:
python car_showroom.py
When you run the script, you will be prompted to choose if you are an Admin or a Customer.
- You can view the list of cars available for sale.
- You can filter cars based on Year or Type (SUV, SED, SPT).
- You can sort cars based on Year and Price (Ascending or Descending).
- You can contact the showroom via phone, email, or by visiting the location.
- You will be prompted for a password. The default password is
passwd
orPasswd
. - Once logged in, you can manage:
- Car list: Add, remove, update car details (price, stock, color).
- Employee list: Add, remove, update employee details (salary, position).
- Admins can also view the system as a customer by switching to Customer Mode.
The following operations are available in Admin Mode:
-
Car Operations:
- View all cars in the showroom.
- Add new cars to the system.
- Remove cars from the system.
- Change the price, stock, and color of any car.
- Sort cars by year, increasing or decreasing price.
-
Employee Operations:
- View all employee details.
- Add new employees to the system.
- Remove employees from the system.
- Change the salary or position of any employee.
-
Switch to Customer Mode: Admins can also switch to customer mode without logging out.
In Customer Mode, the following actions can be performed:
-
View the list of cars available for sale.
-
Sort cars based on different criteria:
- By Year.
- By Price (Ascending or Descending).
- By Type (SUV, SED, or SPT).
-
Filter cars by:
- Year of production.
- Type of car.
-
Contact the showroom via:
- Email.
- Phone (Toll-free).
- Physical location (Address provided).