add methods to decrement occupied spots and check if the parking lot is empty

This commit is contained in:
rafa 2025-05-24 13:34:56 +01:00
parent 82ea463b0c
commit a8bebfc0fc

View File

@ -29,7 +29,15 @@ class CarSpotController {
this->occupied_spots++; this->occupied_spots++;
} }
void decrement_occupied_spots () {
this->occupied_spots--;
}
bool is_full() { bool is_full() {
return this->occupied_spots == this->total_spots; return this->occupied_spots == this->total_spots;
} }
bool is_empty() {
return this->occupied_spots == 0;
}
}; };