Skip to content

guru-shifu/parking-lot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ParkingLot

We'll be focussing on Command Query Separation and Custom Exceptions along with Clean Code practices 

Sanvi parked her car 🚘 in the parking lot so that she can catch her flight.

We have Sanvi's code for parking the car in this repository.

    public void park(Parkable parkable) throws ParkingSlotNotAvailableException, AlreadyParkedException {
        if (!isSlotAvailable())
            throw new ParkingSlotNotAvailableException();
        if(isParked(parkable))
            throw new AlreadyParkedException();
        parkedVehicles.add(parkable);
    }

    private boolean isSlotAvailable() {
        return parkedVehicles.size() < capacity;
    }

    public boolean isParked(Parkable parkable) {
        return parkedVehicles.contains(parkable);
    }

Now it's time for her to go home. Can you help her unpark the car 🚗 ?

You can Fork and Clone this repository to get started .

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages