Requirements
Make any type of car get in if any space is left,
by leave and enrtrance time - calculate how much needed to pay - maybe even allow membership
Define Core Objects
Floor -consists of a list of parking spaces, and has a "getMaxParkingSpaces" function with afiltering ability and "getAvailableParkingSpaces" with the same filtering;
Parking space - and there are other types of parking spaces inheriting like motorcycle space or truck space, also has a function of "canFit" recieving a vehicle type and returning can it fit there
parking lote - consists of floors, embers and payment type
paying ticket - consists of entry time, vehivle number and a nullable leave time. also has a "calculatePrice" function
types of paying ticket - can have a regular, memeber, handicap and a street memeber - all calculating the price differently.
Ticketing facotry - recieving vehicle number and returning the appropriate ticket
Analyze Relationships
inheritance of parking space by the different parking spaces objects,
inheritance of the ticket types
a parking lot has a list of floors and each floor a list of parking spaces
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 { ... } // ExampleAdhere 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...