Loading...
Các đối tượng chính:
plate + sizefloor, number, capacity, trạng thái occupiedid, vehicle, spot, entryTimeenter() và exit()Quan hệ:
ParkingLot quản lý nhiều ParkingSpotParkingLot tạo Ticket khi xe vào, và dùng PricingStrategy khi xe raTicket “gắn” một Vehicle với một ParkingSpot tại entryTimeFor 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.
ParkingLot chỉ lo logic vào/ra + quản lý spot/ticket.PricingStrategy chỉ lo tính phí.Ticket, ParkingSpot, Vehicle giữ dữ liệu + hành vi liên quan trực tiếp.PricingStrategy (không sửa ParkingLot).Car extends Vehicle: có thể dùng Car ở mọi nơi nhận Vehicle.PricingStrategy nhỏ, đúng mục đích.ParkingLot phụ thuộc vào abstraction PricingStrategy, không phụ thuộc class tính phí cụ thể.TreeSet / PriorityQueue theo thứ tự (floor, number).SpotManager để quản lý concurrency tốt hơn.