Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Parking Lot Management System

A Java Swing desktop application for managing a multi-floor parking lot with vehicle entry/exit, automated fee calculation, fine management, and reporting.

Prerequisites

Installing Java

  1. Download and install JDK 17+ from one of the links above.
  2. Set the JAVA_HOME environment variable to your JDK installation path.
  3. Add %JAVA_HOME%\bin to your system PATH.
  4. Verify installation:
    java -version
    

Installing Maven

  1. Download the binary zip from https://maven.apache.org/download.cgi
  2. Extract to a directory (e.g., C:\Program Files\Apache\maven).
  3. Add a MAVEN_HOME environment variable pointing to the extracted folder.
  4. Add %MAVEN_HOME%\bin to your system PATH.
  5. Verify installation:
    mvn -version
    

Building and Running

Compile

mvn clean compile

Run (Normal Mode)

Parking rates are calculated per hour.

mvn exec:java -Dexec.mainClass="com.parkinglot.Main"

Run (Test Mode)

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"

Database

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.

Program Workflow

1. Vehicle Entry

  1. Go to the Entry tab.
  2. Enter the vehicle's license plate number.
  3. Select the vehicle type (Motorcycle, Car, SUV/Truck, or Handicapped).
  4. Check the handicapped card checkbox if applicable.
  5. Click Find Available Spots — the system shows compatible spots based on vehicle type.
  6. Select a spot from the list and confirm.
  7. 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.

2. Vehicle Exit

  1. Go to the Exit tab.
  2. Enter the vehicle's license plate number and click Look Up.
  3. 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.
  4. Select a payment method:
    • Cash — enter the amount tendered; change is calculated automatically.
    • Card — exact amount is charged.
  5. Click Process Payment to complete the exit. A receipt is displayed.

3. Parking Rates

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).

4. Fine Schemes

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.

5. Admin Panel

  • 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.

6. Reports Panel

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.

Parking Lot Layout

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.

Design Patterns

  • Observer Pattern — All UI panels implement ParkingObserver and automatically refresh when parking events occur (vehicle entry/exit, payment, fine scheme change).
  • Singleton PatternParkingLotManager and DatabaseManager ensure a single source of truth throughout the application.

Project Structure

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

About

OOAD Course Assignment

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages