Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...
Entities:
* We could add Vehicle here, but I think all we need from a vehicle is its size, so for simplicity I ommit it.
Relationships:
For each class, define the attributes (data) it will hold and the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation. Write your code in the code editor below.
class ParkingService:
- floors: List
- state: FULL, AVAILABLE
- map: Map
- feeStrategy: FeeStrategy
+ ParkingService(numFloors, feeStrategy)
+ assignSpot(size) -> Ticket
+ checkout(ticket) -> void
class ParkingFloor:
- floorId: string
- state: FULL, AVAILABLE
+ ParkingLot(floorId)
+ isFull() -> bool
+ getAvailableSpot(size) -> ParkingSpot
class ParkingSpot:
- size: VehicleSize
- state: EMPTY, OCCUPIED
+ markEmpty() -> void
+ markOccupied() -> void
class Ticket:
- issue: timestamp
- exit: timestamp
- parkingSpot: ParkingSpot
interface FeeStrategy:
+ calculateFee(ticket) -> double
Explain design tradeoffs you considered. Check and explain whether your design adheres to SOLID principles. Explain how your design can handle changes in scale and whether it would be easy to extend with new functionalities. Identify areas for future improvement...