Requirements

  1. Customers will be assigned a parking spot on a particular parking floor once they enter the building and they will be able to park their vehicle.
  2. Customers will be able to make payments for the parking through UPI or credit cards.
  3. System will calculate the total bill for parking depending on the size of the vehicle and the duration for which it was parked.
  4. Once the customer leaves the parking spot it will be made available for use by other customers.
  5. There will be a set of designated parking spots for old and disabled people.




Define Core Objects

  1. Building - This will consist of list of floors, single building can have multiple floors for parking.
  2. Floor - There will be multiple floors of parking inside a building, each floor will have list of parking spots.
  3. ParkingSpot - There will be multiple parking spots on a single floor, parking spots can be different for different vehicle types such as Car, Bike, Truck.
  4. Payment - There will be payment functionality associated with parking.
  5. Vehicle - This will be the customer's vehicle, depending on the type of vehicle a parking spot will be assigned to the customer.





Analyze Relationships






Establish Hierarchy

Design inheritance trees where applicable to promote code reuse and polymorphism. This step involves identifying common attributes and behaviors that can be abstracted into parent classes...






Design Patterns

Consider using design patterns (e.g., Factory, Singleton, Observer, Strategy) that fit the problem...






Define Class Members (write code)

Attributes: For each class, define the attributes (data) it will hold...

Methods: Define the methods (functions) that operate on the attributes. Ensure they align with the object's responsibilities and adhere to the principle of encapsulation.


public class Car { ... } // Example





Adhere to SOLID Guidelines

Check and explain whether your design adheres to solid principles (Ask interviewer what SOLID principle is if you can not recall it.)...






Consider Scalability and Flexibility

Explain how your design can handle changes in scale and whether it would be easily to extend with new functionalities...






Create/Explain your diagram(s)

Try creating a class, flow, state and/or sequence diagram using the diagramming tool. Mermaid flow diagrams can be used to represent system use cases. You can ask the interviewer bot to create a starter diagram if unfamiliar with the tool. Briefly explain your diagrams if necessary...






Future improvements

Critically examine your design for any flaws or areas for future improvement...