Based on the requirements and use cases, identify the main objects of the system and analyze how they interact and relate to each other...
Here's a Class Diagram illustrating the relationships of the core objects and too each other:
classDiagram
class ParkingGarage {
+ConcurrentHashMap<int, ParkingFloor> floors
+TicketService ticketService
+CreateTicket() Ticket
+CloseTicket() Ticket
}
class TicketService {
-List<Tickets> tickets
-Queue<Vehicle> waitList
+CreateTicket(floors) int
+CloseTicket(ticketId) int
+alertSpotOpen() void
}
class Vehicle {
+getMake/Model/Year() String/Int
+setMake/Model/year() void
+String make
+String model
+int year
+Driver user
+String liscensePlateNum
}
class ParkingFloor {
+getAvailableSpots() availableSpots
+updateParkingSpot(parkingSpot) bool
+int floorNum
+ParkingSpots[] spots
+Queue<ParkingSpots> availableSpots
}
class ParkingSpot {
-method() void
-String[] vehicleTypesAllowed
-int spotNum
-Vehicle Vehicle
-Boolean assigned
}
class Driver {
+method() void
+String fn
+String ln
+int age
+String email
}
class Ticket {
+Date check_in
+Date check_out
+Boolean status
+Int fee
+ParkingSpot spot
+feeCalculation() Float
}
ParkingGarage *-- TicketService
TicketService "1" --> "*" Ticket
TicketService "1" --> "0..*" Vehicle
Vehicle "1" --> "1" Driver
ParkingGarage "1" --> "0..*" ParkingFloor
ParkingFloor "1" --> "0..*" ParkingSpot
ParkingSpot "1" --> "0..1" Vehicle
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...
Future improvement: