Abstract Vehicle Class. Bike, Car and Truck inherit from the Vehicle class. The Vehicle class will have common properties like vehicleNumber, make, colour, etc. Each specialised class sets the vehicleType during instantiation.
The ParkingSlotSize and VehicleSize enum signifies the size of the parking slot (small, medium and large) and Vehicle
The ParkingSlot class represents the attributes and methods owned by the slot where cars would be parked. This class would provide methods like assignVehicle() and removeVehicle(). This class will also maintain a property or provide a method to signify if the slot is occupied or not.
The ParkingTicket class contains the in and out times. This will also have a reference to the parking spot and vehicle to which the parking ticket is issued.
ParkingController
For FareCalculation, I would follow the strategy pattern to define multiple fee calculation strategies (time-based calculation, monthly pass, staff parking, peak-time parking, weekend parking, holiday parking etc.)
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.
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...