Requirements


Functional Requirements:


  • Assign parking spots based on vehicle size, allowing motorcycles to park in small spots, cars in medium spots, and trucks in large spots, with the option to park in larger spots if needed.
  • Issue a ParkingTicket upon vehicle entry, which records the vehicle information, assigned parking spot, and entry timestamp.
  • Compute the parking fee upon vehicle exit based on the duration of stay and a configurable pricing strategy.
  • Handle scenarios where the parking lot is full by rejecting entry and displaying a lot-full indicator to the driver.
  • Support multiple floors in the parking lot, with each floor containing a mix of small, medium, and large parking spots.



Non-Functional Requirements:


    List the key non-functional requirements (eg thread safety, extensibility, maintainability, etc.)...


Core Objects & Relationships


The system needs to define a Parking Lot, Parking Spots, Parking Ticket, and Vehicle information. The relationship between them is that the Parking Lot contains Parking Spots. For each Vehicle that enters the Parking Lot, the system has to assign it a Parking Ticket and a Parking Spot. The fee for the Vehicle is determined by the elapsed time from entry to exit of the Parking Lot.



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


The algorithm isn't the most efficient at finding the best parking spot for a Vehicle based on size. If all small and medium sized spots are taken for a motorcycle, then the algorithm would parse through all spots multiple times. So if the parking lot is extremely large, this would take some time.