A Java Swing desktop application for managing a multi-floor parking lot with vehicle entry/exit, automated fee calculation, fine management, and reporting.
- Java JDK 17 or higher — Download from Oracle or Adoptium
- Apache Maven 3.8+ — Build tool for compiling and running the project
- Download and install JDK 17+ from one of the links above.
- Set the
JAVA_HOMEenvironment variable to your JDK installation path. - Add
%JAVA_HOME%\binto your systemPATH. - Verify installation:
java -version
- Download the binary zip from https://maven.apache.org/download.cgi
- Extract to a directory (e.g.,
C:\Program Files\Apache\maven). - Add a
MAVEN_HOMEenvironment variable pointing to the extracted folder. - Add
%MAVEN_HOME%\binto your systemPATH. - Verify installation:
mvn -version
mvn clean compile
Parking rates are calculated per hour.
mvn exec:java -Dexec.mainClass="com.parkinglot.Main"
Parking rates are calculated per second instead of per hour, useful for testing fines and fee calculations without waiting.
mvn exec:java -Dexec.mainClass="com.parkinglot.Main" -Dexec.args="--test"
The application uses SQLite. A parking.db file is created automatically in the working directory on first run. To reset all data, simply delete parking.db and restart.
- Go to the Entry tab.
- Enter the vehicle's license plate number.
- Select the vehicle type (Motorcycle, Car, SUV/Truck, or Handicapped).
- Check the handicapped card checkbox if applicable.
- Click Find Available Spots — the system shows compatible spots based on vehicle type.
- Select a spot from the list and confirm.
- A parking ticket is generated with the entry timestamp.
Note: All vehicle types may also choose a Reserved spot, but doing so will immediately incur a RM 50 reserved violation fine.
- Go to the Exit tab.
- Enter the vehicle's license plate number and click Look Up.
- The system displays a fee breakdown:
- Parking Fee — based on spot type hourly rate and duration (ceiling-rounded to the nearest hour).
- Reserved Fine — RM 50 if the vehicle parked in a reserved spot.
- Overstay Fine — applied if the vehicle stayed longer than 24 hours, calculated based on the active fine scheme.
- Select a payment method:
- Cash — enter the amount tendered; change is calculated automatically.
- Card — exact amount is charged.
- Click Process Payment to complete the exit. A receipt is displayed.
| Spot Type | Hourly Rate |
|---|---|
| Compact | RM 2.00 |
| Regular | RM 5.00 |
| Handicapped | RM 2.00 |
| Reserved | RM 10.00 |
- Handicapped card holders parking in a Handicapped spot: FREE.
- Handicapped card holders parking in other spots: rate discounted by RM 2.00/hr.
- Duration is ceiling-rounded (e.g., 1 hour 1 minute = 2 hours).
The admin can switch between three fine schemes for overstay violations (parking longer than 24 hours):
| Scheme | Calculation |
|---|---|
| A — Fixed | Flat RM 50 fine |
| B — Progressive | RM 50 (first 24h overstay) + RM 100 (24–48h) + RM 150 (48–72h) + RM 200 (>72h) |
| C — Hourly | RM 20 per hour beyond the 24-hour limit |
- Reserved violation fine: RM 50 flat fee, applies to any vehicle parking in a reserved spot.
- Fine scheme changes apply to future exits only.
- Unpaid fines persist across visits and are linked to the license plate.
- Floor Map — visual grid showing spot availability (green = available, red = occupied), color-coded by spot type.
- Occupancy Stats — per-floor and total occupancy with percentage.
- Revenue — total revenue collected.
- Fine Scheme Selector — switch between Scheme A, B, or C.
- Currently Parked Vehicles — table of active parking sessions with duration.
- Unpaid Fines — table of all outstanding fines.
- Click Refresh to update all data and detect new overstay fines.
Four report tabs:
- Current Vehicles — list of all currently parked vehicles with entry time and duration.
- Revenue — total parking fees collected, total fines collected, and overall revenue.
- Occupancy — per-floor breakdown of occupied vs. total spots with percentages.
- Fine Report — split view showing outstanding (unpaid) fines at the top and full fine history at the bottom.
5 floors, each with 20 spots (4 rows x 5 spots) = 100 total spots.
Spot type distribution varies by floor with a mix of Compact, Regular, Handicapped, and Reserved spots.
- Observer Pattern — All UI panels implement
ParkingObserverand automatically refresh when parking events occur (vehicle entry/exit, payment, fine scheme change). - Singleton Pattern —
ParkingLotManagerandDatabaseManagerensure a single source of truth throughout the application.
src/main/java/com/parkinglot/
├── Main.java # Application entry point
├── model/ # Data models
│ ├── Vehicle.java # Abstract base class
│ ├── Motorcycle.java # Allowed: Compact, Reserved
│ ├── Car.java # Allowed: Compact, Regular, Reserved
│ ├── SUVTruck.java # Allowed: Regular, Reserved
│ ├── HandicappedVehicle.java# Allowed: Compact, Regular, Handicapped, Reserved
│ ├── VehicleType.java # Enum
│ ├── ParkingSpot.java
│ ├── ParkingFloor.java
│ ├── SpotType.java # Enum with hourly rates
│ ├── ParkingTicket.java
│ ├── Fine.java
│ ├── Receipt.java
│ └── PaymentMethod.java # Enum (CASH, CARD)
├── observer/ # Observer pattern
│ ├── ParkingObserver.java # Interface
│ ├── ParkingEvent.java
│ └── ParkingEventType.java # Enum
├── service/ # Business logic
│ ├── ParkingLotManager.java # Singleton + Observable
│ ├── FeeCalculator.java
│ ├── FineCalculator.java
│ └── FineScheme.java # Enum (A, B, C)
├── dao/ # Data access (SQLite)
│ ├── DatabaseManager.java # Singleton, schema init
│ ├── ParkingSpotDAO.java
│ ├── TicketDAO.java
│ ├── FineDAO.java
│ └── PaymentDAO.java
└── ui/ # Swing GUI
├── MainFrame.java # JFrame with tabbed pane
├── EntryExitPanel.java # Vehicle entry and exit
├── AdminPanel.java # Floor map, stats, fine config
└── ReportPanel.java # Reports and analytics