APIs & Class Members
Interfaces and class methods:
- PricingStrategy (interface): Defines the contract for objects that can charge an amount.
- processPayment(amount): charges an amount.
- Vehicle Class:
- getSize(): retrieves the size of the vehicle.
- Ticket Class:
- computeFee(): computes the fee based on parking duration.
- ParkingLot:
- assignParkingSpot(vehicle): assigns a parking spot to a vehicle if it fits and there is enough capacity.
- getAvailableSpots(): retrieves the number of available spots across the whole parking lot.
- ParkingFloor:
- getFirstAvailableSpot(vehicle): retrieves the first available parking spot that suits the bgiven vehicle.
- getAvailableSpots(): retrieves the number of free spots in this floor.
- ParkingSpot:
- isEmpty(): verifies if the parking spot is free or occupied.
- doesItFit(vehicle): checks if a vehicle fits in the spot.
- occupy(vehicle): assigns a vehicle to the parking spot.
- CheckoutService:
- pay(amount): charges the amount with the class' injected payment strategy.