0% found this document useful (0 votes)
13 views

Nishant computerscience projectfinal

The document outlines a Computer Science project titled 'Vehicle Management System' created by T. Nishant for class 12A at PM SHRI Kendriya Vidyalaya No. 2, AFS Pune. The project utilizes Python and Tkinter to manage vehicle details, allowing users to add, view, delete, and calculate fares for vehicles. It includes acknowledgments, a certificate of completion, and a detailed description of the project's features and code structure.
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)
13 views

Nishant computerscience projectfinal

The document outlines a Computer Science project titled 'Vehicle Management System' created by T. Nishant for class 12A at PM SHRI Kendriya Vidyalaya No. 2, AFS Pune. The project utilizes Python and Tkinter to manage vehicle details, allowing users to add, view, delete, and calculate fares for vehicles. It includes acknowledgments, a certificate of completion, and a detailed description of the project's features and code structure.
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/ 20

PM SHRI KENDRIYA

VIDYALAYA No. 2 AFS, PUNE

COMPUTER SCIENCE PROJECT

VEHICLE MANAGEMENTSYSTEM

Subject: Computer Science (083)

Submitted by: Guided


by:
T. Nishant Hari Shankar Rai (PGT
CS)
Class:12th A
Roll no:

Academic Year: 2024 – 2025


ACKNOWLEDGEMENT

I would like to express my special thanks of


gratitude to our Bharat Bhushan, Principal, PM
SHRI K V No. 2, AFS, Pune and to my CS teacher
Hari Shankar Rai sir who gave me the golden
opportunity to do this wonderful project and
provided all necessary support to do the project on
the topic Vehicle Management System which
also allowed me to do a lot of research and I came
to know about so many new things, I am really
thankful to them.

Secondly, I would also like to thank my parents and


friends who helped me a lot in completing this
project within the limited time frame.
T. Nishant

CERTIFICATE

This to certify that T.Nishant of class 12A has


successfully completed his/her python project on
the topic ‘Vehicle Management system’ for the
subject Computer Science (083) as prescribed
by CBSE, under the guidance of Hari Shankar Rai,
PGT CS, during the academic year2024-2025.

Internal Principal
External Examiner
Examiner
CONTENTS

Sr.no Topic Page


no.
1 Introduction 5
2 About the Project 6
3 Code 7
4 Output 14
5 Bibliography & 18
References
INTRODUCTION

The Vehicle Management System is a Python


program designed to securely manage your
vehicle details. This tool helps you store, display,
and manage vehicle data for various uses.

The project features a simple GUI application


built using the Tkinter module, providing a user-
friendly interface. Users can add, view, time out,
and delete vehicle with ease, ensuring they
never forget or misplace their credentials.

The project uses simple Python concepts and


structure formatting in order to make the code
more efficient and readable.
ABOUT THE PROJECT
The objective of this project is to enable students to apply their
programming skills to address real-world challenges, enhancing
their logical thinking and programming abilities throughout the
process.
This Python project provides a secure and efficient solution for
managing data , allowing users to store, display, list, and delete
vehicle details with ease.

This Python program incorporates various concepts, including:


Modules
User-defined functions
Dictionaries
Lists
If, elif, else statements
File handling

Different data types such as strings and integers are manipulated


within this program.
We have applied various concepts from this module, such as
creating a GUI window screen, labels, and buttons.
The program starts with an elegant opening GUI screen,
welcoming the user and displaying options for different
functionalities. Users can add a new vehicle by entering a vehicle
Id, brand, model, year and price,View the vehicle by
clicking on view vehicle button. Each action is accompanied by
informative message boxes that provide feedback to the user.
By integrating these features, the vehicle Manager aims to
enhance online searchability and perfect management over
vehicle details, enabling maintain vehicle detail , without the
hassle of remembering them all

CODE
import tkinter as tk

from tkinter import messagebox

from datetime import datetime

# Dictionary to store vehicle details

vehicle_database = {}

# Fare rate per hour (customize as needed)

FARE_RATE_PER_HOUR = 10.0

# Function to add a vehicle

def add_vehicle():

vehicle_id = entry_vehicle_id.get().strip()

brand = entry_brand.get().strip()

model = entry_model.get().strip()
year = entry_year.get().strip()

price = entry_price.get().strip()

if vehicle_id in vehicle_database:

messagebox.showerror("Error", "Vehicle ID already exists!")

return

if not vehicle_id or not brand or not model or not year or not

price:

messagebox.showerror("Error", "All fields are required!")

return

time_in = datetime.now().strftime("%Y-%m-%d %H:%M:%S")

vehicle_database[vehicle_id] = {

"Brand": brand,

"Model": model,

"Year": year,

"Price": price,

"Time In": time_in,

"Time Out": None

messagebox.showinfo("Success", "Vehicle added successfully!")

clear_entries()

# Function to view all vehicles

def view_vehicles():

if not vehicle_database:
messagebox.showinfo("Info", "No vehicles in the database.")

return

result = "Vehicle List:\n" + "-" * 40 + "\n"

for vehicle_id, details in vehicle_database.items():

result += f"Vehicle ID: {vehicle_id}\n"

for key, value in details.items():

result += f"{key}: {value}\n"

result += "-" * 40 + "\n"

messagebox.showinfo("Vehicle List", result)

# Function to calculate the total fare

def calculate_fare(time_in, time_out):

time_in_dt = datetime.strptime(time_in, "%Y-%m-%d %H:%M:%S")

time_out_dt = datetime.strptime(time_out, "%Y-%m-%d %H:%M:%S")

duration = time_out_dt-time_in_dt

hours = duration.total_seconds() / 3600

return round(hours * FARE_RATE_PER_HOUR, 2)

# Function to search for a vehicle

def search_vehicle():

vehicle_id = entry_vehicle_id.get().strip()

if vehicle_id in vehicle_database:

details = vehicle_database[vehicle_id]

if details["Time Out"] is None:


details["Time Out"] =datetime.now().strftime("%Y-%m-%d%H:

%M:%S")

fare = calculate_fare(details["Time In"], details["Time Out"])

result = f"Vehicle Details:\n" + "-" * 40 + "\n"

for key, value in details.items():

result += f"{key}: {value}\n"

result += f"Total Fare: ${fare}\n"

result += "-" * 40

messagebox.showinfo("Search Result", result)

else:

messagebox.showerror("Error", "Vehicle not found!")

# Function to delete a vehicle

def delete_vehicle():

vehicle_id = entry_vehicle_id.get().strip()

if vehicle_id in vehicle_database:

del vehicle_database[vehicle_id]

messagebox.showinfo("Success", "Vehicle deleted

successfully!")

clear_entries()

else:

messagebox.showerror("Error", "Vehicle not found!")

# Function to clear input fields

def clear_entries():
entry_vehicle_id.delete(0, tk.END)

entry_brand.delete(0, tk.END)

entry_model.delete(0, tk.END)

entry_year.delete(0, tk.END)

entry_price.delete(0, tk.END)

# Main application window

root = tk.Tk()

root.title("Vehicle Management System")

root.geometry("500x600")

root.configure(bg="#f0f8ff")

# Title label

title_label = tk.Label(root, text="Vehicle Management System",

font=("Arial", 16, "bold"), bg="#f0f8ff", fg="#333")

title_label.pack(pady=10)

# Frame for input fields

frame = tk.Frame(root, bg="#f0f8ff")

frame.pack(pady=10)

tk.Label(frame, text="Vehicle ID:", font=("Arial", 12),

bg="#f0f8ff").grid(row=0, column=0, padx=10, pady=5, sticky="w")

entry_vehicle_id = tk.Entry(frame, font=("Arial", 12), width=25)


entry_vehicle_id.grid(row=0, column=1, padx=10, pady=5)

tk.Label(frame, text="Brand:", font=("Arial", 12),

bg="#f0f8ff").grid(row=1, column=0, padx=10, pady=5, sticky="w")

entry_brand = tk.Entry(frame, font=("Arial", 12), width=25)

entry_brand.grid(row=1, column=1, padx=10, pady=5)

tk.Label(frame, text="Model:", font=("Arial", 12),

bg="#f0f8ff").grid(row=2, column=0, padx=10, pady=5, sticky="w")

entry_model = tk.Entry(frame, font=("Arial", 12), width=25)

entry_model.grid(row=2, column=1, padx=10, pady=5)

tk.Label(frame, text="Year:", font=("Arial", 12),

bg="#f0f8ff").grid(row=3, column=0, padx=10, pady=5, sticky="w")

entry_year = tk.Entry(frame, font=("Arial", 12), width=25)

entry_year.grid(row=3, column=1, padx=10, pady=5)

tk.Label(frame, text="Price:", font=("Arial", 12),

bg="#f0f8ff").grid(row=4, column=0, padx=10, pady=5, sticky="w")

entry_price = tk.Entry(frame, font=("Arial", 12), width=25)

entry_price.grid(row=4, column=1, padx=10, pady=5)

# Frame for buttons

button_frame = tk.Frame(root, bg="#f0f8ff")

button_frame.pack(pady=20)
tk.Button(button_frame, text="Add Vehicle", command=add_vehicle,

font=("Arial", 12), bg="#4CAF50", fg="white", width=15).grid(row=0,

column=0, padx=10, pady=5)

tk.Button(button_frame, text="View Vehicles", command=view_vehicles,

font=("Arial", 12), bg="#2196F3", fg="white", width=15).grid(row=0,

column=1, padx=10, pady=5)

tk.Button(button_frame, text="Time out and fare",

command=search_vehicle, font=("Arial", 12), bg="#FF9800", fg="white",

width=15).grid(row=1, column=0, padx=10, pady=5)

tk.Button(button_frame, text="Delete Vehicle", command=delete_vehicle,

font=("Arial", 12), bg="#F44336", fg="white", width=15).grid(row=1,

column=1, padx=10, pady=5)

tk.Button(button_frame, text="Clear", command=clear_entries,

font=("Arial", 12), bg="#9E9E9E", fg="white", width=15).grid(row=2,

column=0, padx=10, pady=5)

tk.Button(button_frame, text="Exit", command=root.quit, font=("Arial",

12), bg="#673AB7", fg="white", width=15).grid(row=2, column=1,

padx=10, pady=5)

# Run the application

root.mainloop()
Output
ADD:vehicle details
VIEW
TIME OUT FARE
BIBLIOGRAPHY&
REFERENCES
Computer Science with Python by Sumita
Arora class 12th.
https://www.w3schools.com
https://www.geeksforgeeks.org
Delete Vehicle

You might also like