Skip to content

Latest commit

 

History

History
44 lines (40 loc) · 1.34 KB

README.md

File metadata and controls

44 lines (40 loc) · 1.34 KB

Parking Lot Project README

Designed a parking lot that can park different size of vehicles.
This parking lot only support basic function, park and exit. It does not support modification of the spot once created (i.e. you cannot add new spot to the existing parking lot).

Designed following classes:

  • public class ParkingLot,
  • private class Spot (represnt the parking spot in the parking lot),
  • public abstract class Vehicle,
  • public class Car extends Vehicle,
  • public class Truck extends Vehicle,
  • public class Bus extends Vehicle.
  • The relationship between the classes are as below:

  • Car isA Vehicle
  • Truck isA Vehicle
  • Bus isA Vehicle
  • Spot hasA Vehicle
  • ParkingLot hasA list of Spot
  • Also designed an enum to indicate the size of the vehicle and the max capacity of the spot.

  • Vehicle size (COMPACT, MIDSIZE, LARGE)
  • ParkingLot has the following methods:

  • isFull
  • findSpotById
  • park(Vehicle)
  • park(Vehicle, Spot)
  • exit(Vehicle)
  • exit(Vehicle, int)
  • Spot has the following methods:

  • getId
  • getMaxCapacity
  • getCurrentVehicle
  • isEmpty
  • fit
  • park
  • leave