The parking lot has multiple floors and different types of parking spots. Different vehicles such as motorcycles, cars, and trucks can enter the parking lot.

When a vehicle enters, the system should assign an appropriate parking spot and issue a parking ticket. When the vehicle exits, the system should calculate the parking fee, accept payment, and free the parking spot.

The design should be extensible enough to support additional vehicle types, parking strategies, and pricing strategies later.

Example 1

A car enters.

Vehicle: Car
Available spots:
Floor 1 → Car Spot #12
Floor 2 → Car Spot #21

System assigns:
Floor 1 → Spot #12

Ticket:
Ticket ID: T101
Entry Time: 10:00 AM
Spot: F1-C12

The car exits at 1:00 PM.

Duration = 3 hours
Rate = ₹50/hour

Fee = ₹150

After payment:

Spot F1-C12 becomes AVAILABLE
Ticket T101 becomes CLOSED

Example 2

A truck enters.

Available:
Motorcycle spots → yes
Car spots → yes
Truck spots → Floor 2 Spot T05

Truck cannot occupy motorcycle/car spots.

System assigns:
Floor 2 → Truck Spot T05

Explaination

ParkingLot.pdf

Solution (CPP)

Solution (Java)