From 0b5c785b2a0d342241ab73ec76a23c545083fb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C5=9F=C4=B1nsu=20Ar=C4=B1c=C4=B1?= Date: Wed, 5 Jan 2022 23:57:16 +0300 Subject: [PATCH] 1603 --- E_1603_DesignParkingSystem.java | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 E_1603_DesignParkingSystem.java diff --git a/E_1603_DesignParkingSystem.java b/E_1603_DesignParkingSystem.java new file mode 100644 index 0000000..844c5f3 --- /dev/null +++ b/E_1603_DesignParkingSystem.java @@ -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; + + } + + +} \ No newline at end of file