Requirements


Functional Requirements:


  • Assign first-fitting spot - On arrival, find the earliest free spot that can fit the vehicle size across floors.
  • Issue ticket on entry - Generate unique ticket with vehicle, spot, and entry time.
  • Compute fee on exit - Calculate duration and apply active PricingStrategy.
  • Lot full handling - If no suitable spot exists, indicate 'Lot Full'.


Core Objects & Relationships

Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...


Core Objects:

  • ParkingLot
  • ParkingFloor
  • ParkingSpot
  • PricingStrategy
  • Vehicle
  • EntryGate
  • ExitGage
  • Ticket
  • Payment


Relationships

ParkingLot

  • ParkingLot has many ParkingFloor (composition)
  • ParkingLot has one PricingStrategy
  • ParkingLot has many EntryGate
  • ParkingLot has many ExitGate


ParkingFloor

  • ParkingFloor has many ParkingSpot (composition)


ParkingSpot

  • ParkingSpot can be associated with at most one Vehicle at a time (0..1)


Ticket

  • Each Ticket is associated with exactly one Vehicle
  • Each Ticket is associated with exactly one ParkingSpot
  • Each Ticket may have zero or one Payment (0..1)


EntryGate

  • EntryGate creates/issues Ticket
  • EntryGate interacts with ParkingLot to allocate ParkingSpot
  • (dependency/behavioral interaction)


ExitGate

  • ExitGate uses PricingStrategy to calculate charges
  • ExitGate processes Payment
  • ExitGate closes Ticket


PricingStrategy

  • PricingStrategy defines the algorithm to calculate parking fees
  • Different implementations can exist (e.g., hourly, flat rate)



Relationship Summary by Type:

Composition:

ParkingLot -> ParkingFloor

ParkingFloor -> PrkingSpot


Association:

ParkingSpot -> Vehicle

Ticket -> Vehicle

Ticket -> ParkingSpot

Ticket -> payment


Dependency:

ExitGate -> PricingStrategy

ExitGate -> Payment

ExitGate -> Ticket



APIs & Class Members

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.





Deep Dive

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