SE-TP2/code/CarSpotController.cpp
2025-05-24 02:52:11 +01:00

35 lines
824 B
C++

class CarSpotController {
private:
int total_spots;
int occupied_spots;
public:
CarSpotController(int default_total_spots) {
this->set_total_spots(default_total_spots);
}
int get_total_spots() {
return this->total_spots;
}
void set_total_spots(int total_spots) {
this->total_spots = total_spots;
}
int get_occupied_spots() {
return this->occupied_spots;
}
void set_occupied_spots(int occupied_spots) {
this->occupied_spots = occupied_spots;
}
void increment_occupied_spots () {
this->occupied_spots++;
}
bool is_full() {
return this->occupied_spots == this->total_spots;
}
};