OOD Parking Lot
Mon, Dec 16, 2019
One-minute read
design a parking lot OOD
Clarify requirement
- basic function: in and out
- size, types(moto, handicap, bus, car, )
- capacity
- levels
- enters
- monitoring to show the vacant space
- change the fee
Define class
- Parking lot
- Parking spot
- Parking ticket
Define field
- Parking lot
- Map<location, parkingSpot>
- Map<location, parkingTicket>
- capacity
- Parking spot
- parking location (ABCDE + no.)
- Parking ticket
- parking location
- enter/exit timestamp
- charge fee ratio/amount
Define method, how data flow works
- Parking lot class
- Ticket park(String vehicle type)
- ticket exit (Ticket ticket)
data flow -> parking vehicle -> according to vehicle type assign spot and return ticket
exit -> release spot, take ticket calculate fee charge -> return ticket as purpose of receipt