School Commit Init
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
#include "block.h"
|
||||
|
||||
Block::Block(int constructionYear, int totalApartments, int occupiedApartments){
|
||||
this->constructionYear = constructionYear;
|
||||
this->totalApartments = totalApartments;
|
||||
this->occupiedApartments = occupiedApartments;
|
||||
}
|
||||
|
||||
bool Block::mustBeRestored(){
|
||||
return (this->constructionYear < 1987) && (this->occupiedApartments/this->totalApartments>0.8);
|
||||
}
|
||||
|
||||
bool Block::canBeDemolished(){
|
||||
return (this->occupiedApartments/this->totalApartments<0.05);
|
||||
}
|
||||
|
||||
std::string Block::toString(){
|
||||
return "Block built in: " + std::to_string(this->constructionYear) + " with " + std::to_string(this->totalApartments) + " apartments, of which " + std::to_string(this->occupiedApartments) + " are occupied.";
|
||||
}
|
||||
Reference in New Issue
Block a user