Requirements

  1. Users should be able to park vehicle in a parking spot if the maximum capacity of the parking lot is not reached.
  2. Users can park vehicles of the following types - Car, Truck and Motorcycle.
  3. Users will be charged at an hourly rate depending on the type of vehicle
  4. Users will be able to see the parking capacity details on a parking lot display board.
  5. Users can make payment by cash or credit card




Define Core Objects

  1. ParkingLot
  2. Floor
  3. Spot - Spots will be of different types such as handicapped, compact, large, motorcycle
  4. Vehicle - Can be of different types such as Car, Truct and motorcycle
  5. ParkingTicket
  6. Payment - Can be done by cash or by card





Analyze Relationships

Determine how these objects will interact with each other to fulfill the use cases...






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