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

Computer Investigatory

The document outlines a project on a 'Parking Management System' developed using Python and MySQL, detailing its features, advantages, and technical requirements. It includes an introduction to Python, its history, and the advantages of using MySQL for database management. The project aims to improve the efficiency of managing parking spaces and provides user documentation for operating the system.

Uploaded by

izaanhafid.a2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

Computer Investigatory

The document outlines a project on a 'Parking Management System' developed using Python and MySQL, detailing its features, advantages, and technical requirements. It includes an introduction to Python, its history, and the advantages of using MySQL for database management. The project aims to improve the efficiency of managing parking spaces and provides user documentation for operating the system.

Uploaded by

izaanhafid.a2
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Acknowledgement

I would firstly like to express my gratitude towards my


Computer Science teacher, Mr Yadav Singh, who had
provided me with assistance with this wonderful
project on the topic, ‘Parking Management System,’
which has helped me in understanding the new
concepts related to Python and MySQL. I would also
like to thank my fellow students for their guidance in
my shortcomings.

I am greatly thankful towards to them for helping me


complete the project in the allotted time.
Index
Introduction To Python

The Python language was developed by Guido Van Rossum in


1991. Python is one of the most ubiquitous programming
languages hence grants a comprehensive view on most
branches of computer science.
Python is an open-source programming language meaning
that it is open to be used and modified by all people. Its main
uses lie in web programming, data science, and many other
scientific applications.
Its comparatively small size and ease of use give it an
advantage over other languages such as C++ and Java.
Quite a few of the top companies use python in their
processes such as Google, Instagram, Spotify, Netflix and
many more.
History Of Python
In the late 1980s, Python began its journey to being one of
the most used programming languages of the world. Soon
after, Guido van rossum began doints its application based
work in december of 1989 at CWI ( Centrum Wiskunde &
Informatica) which is located in the Netherlands. It began as
a hobby project to cure his boredom.

Python is considered a successor to the ABC Programming


Language, which had the interfacingwith the AMOEBA
Operating System and had the ability to handle exceptions.
Guido Van Rossum also played a part in creating the ABC
Programming Language.

When python was released, it used a low fewer lines to


express concepts compared to Java and C++. Its philosophy
was to provide the best readability and developer
productivity.
Features Of Python
Easy to Code :
Python is a high-level programming language. Python is easy
to learn compared to other languages like C++, Java, etc. It is
very easy to code in python language and anybody can learn
python basics in a few hours or days.

Open Source:
Python is free and easily accessible from the official website,
As it is open-source, this means that the source code is
available to the public, Meaning that you can access and
change code.

Object Oriented Language:


One of the key features of python is its Object-Oriented
programming. Python supports object-oriented language and
concepts of classes, objects encapsulation, etc.

Portable Language :
Python is a portable language. For example, if we have
python code for Windows and if we want to run this code on
other platforms such as Linux, and Mac then we do not need
to change it, we can run this code on any platform.
Advantages Of Python
Free and Open Source :
Python comes under the open-source license. This makes it
free to use and distribute. You can download the source
code, modify it and distribute your version of Python. This is
useful for organizations that want to modify some specific
parts and use their version for development.

Portability:
A Python code can be run in any platform without any
changed needing to be made.

Improved Productivity:
Python is a very productive language. Due to its ease of use,
developers can focus on solving the issues than worrying
about syntax errors and behaviour of the language.
Features Of MySQL

Scalable:
Scalability refers to the ability to work easily with small or
large amounts of data . MySQL was developed to work with
all types of databases.

Data Types:
It contains data types such as signed integers, unsigned
integers, float, text, date, time etc.

Secure:
It provides a secure interface since it has a password system
which ensures that its verified based on the host before
accessing the database. The password is encrypted when
connecting to a server.
Project Description

Preface:
Parking Management System is an application that enable
users to create and store parking details. This application is
helpful in maintain the details about parking spaces.

For a place with lots of parking spaces managing and keeping


track of details which are updated regularly , requires the use
of a database which can ensure that all operations are
carried out properly. With the help of this program we are
providing an application that gives managers a method to
update details in an easy and feasible manner.

The Vision behind this project was to create a database that


serves as a way to properly manage and regulate the
constant flow of cars through parking spaces. Through the
program I wanted to provide a way to improve the efficiency
of parking as we live in a fast paced community where
efficiency is key to whether a service is extraordinary or
inadequate.
All in all, The Parking Management System is a application
that aims to reduce the occurrence of issues faced in Parking
Areas.
AIM
The objective of this project is to apply programming
knowledge into a real life issue and understanding how
programming skills help in developing a good program.

Technical Documentation

Hardware Requirements:
1) Processor: Pentium III or above
2) Hard Disk : 1 GB or more
3) RAM : 4 GB or more
4) CPU
5) Monitor
6) Keyboard & Mouse

Software Requirements:
1) Operating System: Windows 10 or above
2) Language: Python
3) Application: MySQL
User Documentation

This program can be used by anyone. They should first


download python from the internet and paste the source
code of this system. They should also have SQL downloaded,
as the data base is oriented in Python-SQL connectivity.

This System incorporates aspects of Python and SQL. In the


beginning a SQL Database with relevant tables containing
details regarding the parking spaces is made . The python
code is used to provide the user access to the data in the
database, to update modify and work upon it.

Once the code is started the user is presented with choices


from which the user needs to pick that one that’s needed.
Code:
import mysql.connector
import time
from datetime import date

global conn, cursor


conn = mysql.connector.connect(
host='localhost', database=' parking_system', user='root', password='')
cursor = conn.cursor()

def clear():
for _ in range(65):
print()

def display_parking_type_records():
cursor.execute('select * from parking_type;')
records = cursor.fetchall()
for row in records:
print(row)

def login():
while True:
clear()
nameid = input('Enter your id :')
idpass = input('Enter your Password :')
cursor.execute('select * from login where name="{}" and pwd ="{}"'.format(nameid, idpass))
cursor.fetchall()
rows = cursor.rowcount
if rows != 1:
print('Invalid Login details..... Try again')
else:
print('You are eligible for operating this system............')
print('\n\n\n')
print('Press any key to continue...............')
break

def add_parking_type_record():
clear()
name = input('Enter Parking Type( 1. Two wheelar 2. Car 3. Bus 4. Truck 5. Trolly ) : ')
cost = input('Enter Parking cost per day : ')
sql = 'insert into parking_type(name,cost) values("{}",{});'.format(name, cost)
cursor.execute(sql)
print('\n\n New Parking Type added....')
cursor.execute('select max(id) from parking_type')
no = cursor.fetchone()
print(' New Parking Type ID is : {} \n\n\n'.format(no[0]))
wait = input('\n\n\nPress any key to continue............')

def add_parking_slot_record():
clear()
parking_type_id = input(
'Enter Parking Type( 1. Two wheelar 2. Car 3. Bus 4. Truck 5. Trolly ) :')
status = input('Enter current Status ( Open/Full ) :')
sql = 'insert into parking_space(type_id,status) values \
("{}","{}");'.format(parking_type_id, status)
cursor.execute(sql)
print('\n\n New Parking Space Record added....')

cursor.execute('select max(id) from parking_space;')


no = cursor.fetchone()
print(' Your Parking ID is : {} \n\n\n'.format(no[0]))
display_parking_type_records()
wait = input('\n\n\nPress any key to continue............')

def modify_parking_type_record():
clear()
print(' M O D I F Y P A R K I N G T Y P E S C R E E N ')
print('-' * 100)
print('1. Parking Type Name \n')
print('2. Parking cost \n')
choice = int(input('Enter your choice :'))
field = ''
if choice == 1:
field = 'name'
if choice == 2:
field = 'cost'

park_id = input('Enter Parking Type ID :')


value = input('Enter new values :')
sql = 'update parking_type set ' + field + ' = "' + value + '" where id =' + park_id + ';'
cursor.execute(sql)
print('Record updated successfully................')
display_parking_type_records()
wait = input('\n\n\nPress any key to continue............')

def modify_parking_space_record():
clear()
print(' M O D I F Y P A R K I N G S P A C E R E C O R D ')
print('-' * 100)
print('1. Parking Type ID(1-Two Wheelar, 2: Car 3.Bus etc ): ')
print('2. status \n')
choice = int(input('Enter your choice :'))
field = ''
if choice == 1:
field = 'type_id'
if choice == 2:
field = 'status'
print('\n\n\n')
crime_id = input('Enter Parking Space ID :')
value = input('Enter new values :')
sql = 'update parking_space set ' + field + \
' = "' + value + '" where id =' + crime_id + ';'
cursor.execute(sql)
print('Record updated successfully................')
wait = input('\n\n\nPress any key to continue............')

def add_new_vehicle():
clear()
print('Vehicle Login Screen ')
print('-' * 100)
vehicle_id = input('Enter Vehicle Number :')
parking_id = input('Enter parking ID :')
entry_date = date.today()
sql = 'insert into transaction(vehicle_id,parking_id,entry_date) values \
("{}","{}","{}");'.format(vehicle_id, parking_id, entry_date)
cursor.execute(sql)
cursor.execute('update parking_space set status ="full" where id ={}'.format(parking_id))
print('\n\n\n Record added successfully.................')
wait = input('\n\n\nPress any key to continue.....')

def remove_vehicle():
clear()
print('Vehicle Logout Screen')
print('-' * 100)
vehicle_id = input('Enter vehicle No :')
exit_date = date.today()
sql = 'select parking_id,cost,entry_date from transaction tr,parking_space ps, parking_type pt \
where tr.parking_id = ps.id and ps.type_id = pt.id and \
vehicle_id ="' + vehicle_id + '" and exit_date is NULL;'
cursor.execute(sql)
record = cursor.fetchone()
days = (exit_date - record[2]).days
if days == 0:
days = days + 1
amount = record[1] * days
clear()
print('Logout Details ')
print('-' * 100)
print('Parking ID : {}'.format(record[0]))
print('Vehicle ID : {}'.format(vehicle_id))
print('Parking Date : {}'.format(record[2]))
print('Current Date : {}'.format(exit_date))
print('Amount Payable : {}'.format(amount))
wait = input('press any key to continue......')
# update transaction and parking space tables
sql1 = 'update transaction set exit_date ="{}" , amount ={} where vehicle_id ="{}" \
and exit_date is NULL;'.format(exit_date, amount, vehicle_id)
sql2 = 'update parking_space set status ="open" where id = {}'.format(record[0])
cursor.execute(sql1)
cursor.execute(sql2)
wait = input('Vehicle Out from our System Successfully.......\n Press any key to continue....')

def search_menu():
clear()
print(' S E A R C H P A R K I N G M E N U ')
print('1. Parking ID \n')
print('2. Vehicle Parked \n')
print('3. Free Space \n')
choice = int(input('Enter your choice :'))
field = ''
if choice == 1:
field = 'id'
if choice == 2:
field = 'vehicle No'
if choice == 3:
field = 'status'
value = input('Enter value to search :')
if choice == 1 or choice == 3:
sql = 'select ps.id,name,cost, status \
from parking_space ps , parking_type pt where ps.id = pt.id AND ps.id ={}'.format(value)
else:
sql = 'select id,vehicle_id,parking_id,entry_date from transaction where exit_date is NULL;'

cursor.execute(sql)
results = cursor.fetchall()
records = cursor.rowcount
for row in results:
print(row)
if records < 1:
print('Record not found \n\n\n ')
wait = input('\n\n\nPress any key to continue......')

def parking_status(status):
clear()
print('Parking Status :', status)
print('-' * 100)
sql = "select * from parking_space where status ='{}'".format(status)
cursor.execute(sql)
records = cursor.fetchall()
for row in records:
print(row)
wait = input('\n\n\nPress any key to continue.....')

def vehicle_status_report():
clear()
print('Vehicle Status - Currently Parked')
print('-' * 100)
sql = 'select * from transaction where exit_date is NULL;'
cursor.execute(sql)
records = cursor.fetchall()
for row in records:
print(row)
wait = input('\n\n\nPress any key to continue.....')

def money_taken():
clear()
start_date = input('Enter start Date(yyyy-mm-dd): ')
end_date = input('Enter End Date(yyyy-mm-dd): ')
sql = "select sum(amount) from transaction where \
entry_date ='{}' and exit_date ='{}'".format(start_date, end_date)
cursor.execute(sql)
result = cursor.fetchone()
clear()
print('Total money Collected from {} to {}'.format(start_date, end_date))
print('-' * 100)
print(result[0])
wait = input('\n\n\nPress any key to continue.....')

def report_menu():
while True:
clear()
print(' P A R K I N G R E P O R T S ')
print('-' * 100)
print('1. Parking Types \n')
print('2. Free Space \n')
print('3. Ocupied Space \n')
print('4. Vehicle Status \n')
print('5. Money Collected \n')
print('6. Exit \n')
choice = int(input('Enter your choice :'))
field = ''
if choice == 1:
display_parking_type_records()
if choice == 2:
parking_status("open")
if choice == 3:
parking_status("full")
if choice == 4:
vehicle_status_report()
if choice == 5:
money_taken()
if choice == 6:
break

def main_menu():
clear()
login()
clear()
introduction()

while True:
clear()
print(' P A R K I N G M A N A G E M E N T S Y S T E M')
print('*' * 100)
print("\n1. Add New Parking Type")
print("\n2. Add New Parking Slot")
print('\n3. Modify Parking Type Record')
print('\n4. Modify Parking Slot Record')
print('\n5. Vehicle Login ')
print('\n6. Vehicle Logout')
print('\n7. Search menu')
print('\n8. Report menu')
print('\n9. Close application')
print('\n\n')
choice = int(input('Enter your choice ...: '))

if choice == 1:
add_parking_type_record()

if choice == 2:
add_parking_slot_record()

if choice == 3:
modify_parking_type_record()

if choice == 4:
modify_parking_space_record()

if choice == 5:
add_new_vehicle()

if choice == 6:
remove_vehicle()

if choice == 7:
search_menu()

if choice == 8:
report_menu()

if choice == 9:
break
made_by()

if __name__ == "__main__":
main_menu()
Output

You might also like