Skip to content

Commit

Permalink
1603
Browse files Browse the repository at this point in the history
  • Loading branch information
isinsuarici committed Jan 5, 2022
1 parent 2132066 commit 0b5c785
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions E_1603_DesignParkingSystem.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
public class ParkingSystem {
int a, b, c;

public ParkingSystem(int big, int medium, int small) {
this.a = big;
this.b = medium;
this.c = small;
}

public boolean addCar(int carType) {
if (carType == 1 && a > 0) {
a--;
return true;
}
else if (carType == 2 && b > 0) {
b--;
return true;
}
else if (carType == 3 && c > 0) {
c--;
return true;
}
return false;

}


}

0 comments on commit 0b5c785

Please sign in to comment.