From a8bebfc0fc8c807e27b2ca5254d515cb3f0a8ef2 Mon Sep 17 00:00:00 2001 From: rafa Date: Sat, 24 May 2025 13:34:56 +0100 Subject: [PATCH] add methods to decrement occupied spots and check if the parking lot is empty --- code/CarSpotController.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/code/CarSpotController.cpp b/code/CarSpotController.cpp index 44bf859..8a31e19 100644 --- a/code/CarSpotController.cpp +++ b/code/CarSpotController.cpp @@ -29,7 +29,15 @@ class CarSpotController { this->occupied_spots++; } + void decrement_occupied_spots () { + this->occupied_spots--; + } + bool is_full() { return this->occupied_spots == this->total_spots; } + + bool is_empty() { + return this->occupied_spots == 0; + } }; \ No newline at end of file