Java MiniProject
Java MiniProject
Java MiniProject
Project Report on
Prof. XYZ
401501 (2023-24)
“Car Parking Management”
Submitted in partial fulfillment of the requirements of the Degree of
By
Prof. XYZ
University of Mumbai
(2023-2024)
DEPARTMENT OF COMPUTER ENGINEERING
CERTIFICATE
This is to certify that the Project entitled “Car Parking Management” is a bonafide
work of Mr. JUNED KHAN (55), Mr. TALHA KHAN (17), Mr. SHADAN
SHAIKH (67), Mr. ANAS SAYYED submitted to the University of Mumbai in
partial fulfillment of the requirement for the award of the Degree of “Bachelor of
Computer Engineering”.
The project entitled “Mr. JUNED KHAN (55), Mr. TALHA KHAN (56), Mr.
SHADAN SHAIKH (67), Mr. ANAS SAYED(64)”is approved for the Degree of
“Bachelor of Computer Engineering.”
Examiners
1.………………………
2.…………………...….
Date:
Place:
DECLARATION
We declare that this written submission represents our ideas in my own words and
where others’ ideas or words have been included, we have adequately cited and
referenced the original sources. We also declare that we have adhered to all principles
of academic honesty and integrity and have not misrepresented or fabricated or
falsified any idea/data/fact/source in my submission. We understand that any violation
of the above will be cause for disciplinary action by the Institute and can also evoke
penal action from the sources which have thus not been properly cited or from whom
proper permission has not been taken when needed.
Date:
ACKNOWLEDGEMENT
First and foremost we thank God Almighty for blessing us immensely and
empowering me at times of difficulty like a beacon of light. Without His divine
intervention I wouldn’t have accomplished this project without any hindrance.
We are also grateful to the Management of Theem College of Engineering for their
kind support. Moreover, we thank our beloved Principal Dr. Riyazuddin Siddiqui,
Director, Dr. N.K. Rana for their constant encouragement and valuable advice
throughout the course.
Also, we would like to take this opportunity to express my profound thanks to our
guide Prof. XYZ, Assistant Professor, Computer Engineering for his/her valuable
advice and whole hearted cooperation without which this project would not have
seen the light of day.
v
ABSTRACT
Key features of the system include dynamic parking lot management, parking
spot allocation based on availability, real-time display of parking spot status, a user-
friendly console interface, and basic error handling to ensure a smooth user
interaction. The project is designed to optimize the use of available parking space,
provide a streamlined process for drivers, empower administrators with informed
decisions on resource utilization, and contribute to improved traffic flow and reduced
congestion.
vi
INDEX
02 Interface 09-11
04 Park Car 14
06 Exit 18
07 Code 19-24
08 Conclusion 25
vii
Chapter No. 1: Car Parking Management
Features:
The Car Parking Management System boasts several features that contribute to
its effectiveness and user-friendliness:
Users, including both administrators and drivers, can view real-time status
updates of parking spots, enabling quick decision-making.
viii
Chapter No. 2: Interface
The project contains an interface which gives users a variety of options which
indirectly displays the functions of the system. The interface contains a set of
options:
Code:
while (true) {
System.out.println("4. Exit");
ix
switch (choice) {
case 1:
parkingLot.displayParkingLot();
break;
case 2:
parkingLot.parkCar(newCar);
break;
case 3:
if (departingCar != null) {
break;
x
case 4:
System.exit(0);
break;
default:
Console:
xi
Chapter No. 3: Display Parking Lot Status
Code:
System.out.println(spot);
if (!spot.isOccupied()) {
spot.parkCar(car);
return;
Console:
xii
xiii
Chapter No. 4: Park car
CODE:
if (!spot.isOccupied()) {
spot.parkCar(car);
return;
CONSOLE:
xiv
xv
Chapter No. 5: leave parking spot
The leaveSpot method is responsible for deallocating a parking spot when a car
leaves. It allows a user to specify the spot number from which the car is departing,
and the system marks that spot as vacant.
The leaveSpot method is crucial for maintaining an accurate representation of
parking spot occupancy in the system. By allowing users to specify the spot from
which a car is departing, the method ensures that the parking lot status is updated
accordingly. This functionality contributes to the overall goal of efficiently
managing parking spaces within the parking lot.
CODE:
public Car leaveSpot(int spotNumber) {
if (isValidSpotNumber(spotNumber)) {
ParkingSpot spot = spots.get(spotNumber - 1);
if (spot.isOccupied()) {
return spot.leaveSpot();
} else {
System.out.println("Spot " + spotNumber + " is already empty.");
}
} else {
System.out.println("Invalid spot number.");
}
return null;
}
xvi
Scanner scanner = new Scanner(System.in);
System.out.print("Enter the capacity of the parking lot: ");
int capacity = scanner.nextInt();
while (true) {
System.out.println("\nCar Parking Management Menu:");
System.out.println("1. Display Parking Lot Status");
System.out.println("2. Park Car");
System.out.println("3. Leave Parking Spot");
System.out.println("4. Exit");
System.out.print("Enter your choice: ");
switch (choice) {
case 1:
parkingLot.displayParkingLot();
break;
case 2:
scanner.nextLine(); // Consume the newline character
System.out.print("Enter car license plate: ");
String licensePlate = scanner.nextLine();
System.out.print("Enter car brand: ");
String brand = scanner.nextLine();
xvii
case 3:
System.out.print("Enter spot number to leave: ");
int spotNumber = scanner.nextInt();
Car departingCar = parkingLot.leaveSpot(spotNumber);
if (departingCar != null) {
System.out.println("Car leaving spot: " + departingCar);
}
break;
CONSOLE:
xviii
The exit functionality allows the user to terminate the program gracefully,
bringing the execution to a halt and returning control to the operating system.
The exit functionality is essential for providing users with a clean and
straightforward way to exit the program. It ensures that resources are released, and
any cleanup operations are performed before the program concludes.
CODE:
case 4:
System.out.println("Exiting Car Parking Management. Goodbye!");
System.exit(0);
break;
default:
System.out.println("Invalid choice. Please enter a valid option.");
}
}
}
}
CONSOLE:
xix
Chapter No. 7: Code
import java.util.ArrayList;
import java.util.Scanner;
class Car {
private String licensePlate;
private String brand;
@Override
public String toString() {
return "License Plate: " + licensePlate + ", Brand: " + brand;
}
}
class ParkingSpot {
private int spotNumber;
xx
private Car parkedCar;
@Override
public String toString() {
if (isOccupied()) {
return "Spot " + spotNumber + ": " + parkedCar;
} else {
xxi
return "Spot " + spotNumber + ": Empty";
}
}
}
class ParkingLot {
private ArrayList<ParkingSpot> spots;
xxii
public Car leaveSpot(int spotNumber) {
if (isValidSpotNumber(spotNumber)) {
ParkingSpot spot = spots.get(spotNumber - 1);
if (spot.isOccupied()) {
return spot.leaveSpot();
} else {
System.out.println("Spot " + spotNumber + " is already empty.");
}
} else {
System.out.println("Invalid spot number.");
}
return null;
}
while (true) {
System.out.println("\nCar Parking Management Menu:");
System.out.println("1. Display Parking Lot Status");
xxiii
System.out.println("2. Park Car");
System.out.println("3. Leave Parking Spot");
System.out.println("4. Exit");
System.out.print("Enter your choice: ");
switch (choice) {
case 1:
parkingLot.displayParkingLot();
break;
case 2:
scanner.nextLine(); // Consume the newline character
System.out.print("Enter car license plate: ");
String licensePlate = scanner.nextLine();
System.out.print("Enter car brand: ");
String brand = scanner.nextLine();
case 3:
System.out.print("Enter spot number to leave: ");
int spotNumber = scanner.nextInt();
Car departingCar = parkingLot.leaveSpot(spotNumber);
if (departingCar != null) {
System.out.println("Car leaving spot: " + departingCar);
}
break;
xxiv
case 4:
System.out.println("Exiting Car Parking Management. Goodbye!");
System.exit(0);
break;
default:
System.out.println("Invalid choice. Please enter a valid option.");
}
}
}
}
xxv
The conclusion section serves as the final segment of the program execution,
providing an opportunity to perform cleanup activities, display a farewell
message, and summarize the overall experience of using the Car Parking
Management System.
The conclusion section is significant as it ensures a proper and graceful
termination of the program.
It provides a positive and informative ending to the user, making their experience
with the Car Parking Management System more satisfying.
The conclusion section is the last impression the user has of the program. A well-
crafted conclusion ensures a positive user experience, communicates the
successful execution of the program, and leaves the user with a sense of closure.
User Experience:
It ensures a positive and polished user experience by providing a clear and
friendly termination message.
Resource Management:
Cleanup operations contribute to proper resource management, closing any
open connections and releasing allocated resources.
Feedback and Closure:
The farewell message provides feedback to the user and a sense of closure,
concluding their interaction with the system.
xxvi