Parking project
Parking project
System
By- Atharva Jagtap
Class- XII A
PM Shri Kendriya Vidyalaya INS Hamla
______________ _______________
Subject Teacher Internal Examiner
ACKNOWLEDGEMENT
It is with pleasure that I acknowledge my sincere gratitude to our teacher,
MRS. Savita Sharma(PGT Computer Science) who taught and undertook
the responsibility of teaching the subject computer science. I have been
greatly benefited from her classes.
I am especially indebted to our Principal MRS. Madhulika Mishra 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 her.
Finally, I would like to express my sincere appreciation for all the other
students for my batch their friendship & the fine time that we all shared
together.
INDEX
Basics of SQL
Database design
Source Code
Output
Bibliography
BASICS OF SQL
DATA BASE :-
A database is an organized collection of structured information, or data,
typically stored electronically in a computer system. It is designed to
efficiently store, manage, retrieve, and manipulate data for various
purposes.
Key Characteristics:
Organization: Databases are structured to allow for easy access and
management. This structure is usually defined by a database schema,
which outlines how data is stored and related to each other.
Accessibility: Databases provide mechanisms for users to access and
query data. This is often achieved through a Database Management
System (DBMS) that serves as an interface between users and the data
Efficiency: Databases are designed to handle large amounts of
data efficiently. They use indexing, querying, and transaction
processing to ensure that data operations are performed
quickly and reliably.
Consistency: Databases maintain data consistency and
integrity through the use of constraints and transactions,
ensuring that data remains accurate and reliable.
Security: Databases include security measures to protect data
from unauthorized access and breaches. This can include user
authentication, access controls, and encryption.
Components of a Database:
Tables: Organized structures that store data in rows and
columns.
Queries: Tools to retrieve specific data by searching the
database.
Forms: User interfaces for data entry and modification.
Reports: Tools to generate structured outputs from the data.
Schemas: Blueprints that define the structure of the
database, including tables, fields, and relationships.
A
Examples of RDBMS:
Oracle Database
MySQL
Microsoft SQL Server
PostgreSQL
a
data is stored. Each row represents a record, and each column
represents a field in that record.
Query: A query is a request for data or information from a
database table or combination of tables. SQL queries are used
DATABASE DESIGN
1.First we have to create a
database.
;;
5. Create Transaction
table.
6. Transaction
table.
7. Creating Feedback
table
8. Feedback table
SOURCE CODE
import mysql.connector
from datetime import datetime
def connect_to_db():
return mysql.connector.connect(
host="localhost",
user="root",
password="2404",
database="parking_management"
)
def create_tables():
db = connect_to_db()
cursor = db.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS ParkingSlots (
slot_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20) UNIQUE,
vehicle_type VARCHAR(20),
is_parked BOOLEAN DEFAULT FALSE,
entry_time DATETIME,
exit_time DATETIME
);
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS Transactions (
transaction_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20),
vehicle_type VARCHAR(20),
entry_time DATETIME,
exit_time DATETIME,
amount DECIMAL(10, 2),
FOREIGN KEY (vehicle_number) REFERENCES ParkingSlots(vehicle_number)
);
""")
cursor.execute("""
CREATE TABLE IF NOT EXISTS Feedback (
feedback_id INT AUTO_INCREMENT PRIMARY KEY,
vehicle_number VARCHAR(20),
feedback_text TEXT,
submitted_at DATETIME,
FOREIGN KEY (vehicle_number) REFERENCES ParkingSlots(vehicle_number)
);
""")
db.commit()
cursor.close()
db.close()
def greet_user():
print("\nWelcome to the Parking Management System!")
print("How can we assist you today?\n")
def show_rate_chart():
print("\n--- Rate Chart ---")
print("Day Parking:")
print("Two Wheelers: Rs 5/hour")
print("Car/Van/Mini Bus: Rs 10/hour")
print("Bus/Lorry: Rs 20/hour")
print("\nNight Parking:")
print("Two Wheelers: Rs 10/hour")
print("Car/Van/Mini Bus: Rs 30/hour")
print("Bus/Lorry: Rs 60/hour")
print("------------------\n")
if is_day_time:
rates = {
“Two Wheeler”:5,
“Car/van/Mini Bus”:10,
“Bus/Lorry”:20
}
else:
rates = {
"Two Wheeler": 10,
"Car/Van/Mini Bus": 30,
"Bus/Lorry": 60
}
def release_slot(vehicle_number):
db = connect_to_db()
cursor = db.cursor()
cursor.execute("SELECT entry_time, vehicle_type FROM ParkingSlots WHERE vehicle_number = %s AND is_parked = %s",
(vehicle_number, True))
result = cursor.fetchone()
if not result:
print("No vehicle found or vehicle is not currently parked.")
else:
entry_time, vehicle_type = result
exit_time = datetime.now().replace(second=0, microsecond=0)
amount = calculate_parking_fee(vehicle_type, entry_time, exit_time)
db.commit()
print(f"Vehicle {vehicle_number} released. Amount due: Rs {amount}.\n")
print_receipt(vehicle_number, vehicle_type, entry_time, exit_time, amount)
cursor.close()
db.close()
def print_receipt(vehicle_number, vehicle_type, entry_time, exit_time, amount):
print("\n--- Parking Receipt ---")
print(f"| Vehicle Number: {vehicle_number:<15} |")
print(f"| Vehicle Type: {vehicle_type:<15} |")
print(f"| Entry Time: {entry_time:<15} |")
print(f"| Exit Time: {exit_time:<15} |")
print(f"| Total Amount: Rs {amount:<15} |")
print("-------------------------")
print("Thank you for using our service! Have a great day!\n")
def view_transactions():
db = connect_to_db()
cursor = db.cursor()
cursor.close()
db.close()
def collect_feedback(vehicle_number):
feedback = input("Please provide your feedback: ")
submitted_at = datetime.now().replace(second=0, microsecond=0)
db = connect_to_db()
cursor = db.cursor()
cursor.execute("INSERT INTO Feedback (vehicle_number, feedback_text, submitted_at) VALUES (%s, %s, %s)",
(vehicle_number, feedback, submitted_at))
db.commit()
cursor.close()
db.close()
def view_feedback():
db = connect_to_db()
cursor = db.cursor()
cursor.close()
db.close()
def collect_feedback(vehicle_number):
feedback = input("Please provide your feedback: ")
submitted_at = datetime.now().replace(second=0, microsecond=0)
db = connect_to_db()
cursor = db.cursor()
cursor.execute("INSERT INTO Feedback (vehicle_number, feedback_text, submitted_at) VALUES (%s, %s, %s)",
(vehicle_number, feedback, submitted_at))
db.commit()
cursor.close()
db.close()
def view_feedback():
db = connect_to_db()
cursor = db.cursor()
cursor.close()
db.close()
def main():
create_tables()
greet_user()
while True:
print("1. Reserve Parking Slot")
print("2. Release Parking Slot")
print("3. View Transactions")
print("4. Provide Feedback")
print("5. View Feedback")
print("6. Exit")
if choice == "1":
vehicle_number = input("Enter vehicle number: ")
vehicle_type = input("Enter vehicle type (Two Wheeler/Car/Van/Mini Bus/Bus/Lorry): ")
reserve_slot(vehicle_number, vehicle_type)
elif choice == "2":
vehicle_number = input("Enter vehicle number: ")
release_slot(vehicle_number)
elif choice == "3":
view_transactions()
elif choice == "4":
vehicle_number = input("Enter your vehicle number: ")
collect_feedback(vehicle_number)
elif choice == "5":
view_feedback()
elif choice == "6":
print("Thank you for using the Parking Mangement system. Goodbye!")
break
else:
print("Invalid choice. Please try again")
OUTPUT
Main Menu To park vehicle
To unpark vehicle
To view transaction
To give feedback
To view feedback
Exit
BIBLIOGRAPHY
Python (Sumita Arora Class XII)
MySQL
THANK YOU