world = $world_; $this->name = $name_; //We calculate the $this->mineralsPrice = (1 / $world_->minerals)*$this->priceCoef; $this->energyPrice = (1/ $world_->energy)*$this->priceCoef; $this->vegetablePrice = (1/ $world_->vegetable)*$this->priceCoef; $this->animalsPrice = (1/ $world_->animals)*$this->priceCoef; $this->waterPrice = (1/ $world_->water)*$this->priceCoef; } public function getPIB($town, $macroEco){ $minerals = ($town->minerals)*$macroEco->mineralsPrice; $energy = ($town->energy)*$macroEco->energyPrice; $vegetable = ($town->vegetable)*$macroEco->vegetablePrice; $animals = ($town->animals)*$macroEco->animalsPrice; $water = ($town->water)*$macroEco->waterPrice; $this->PIB = ($minerals+ $energy+$vegetable+ $animals+$water); return $this->PIB; } public function print(){ echo '*******************************
'; echo ' '.$this ->name.' ECONOMY
'; echo '*******************************
'; echo 'mineralsPrice: $'.$this ->mineralsPrice.'
'; echo 'energyPrice: $'.$this ->energyPrice.'
'; echo 'vegetablePrice: $'.$this ->vegetablePrice.'
'; echo 'animalsPrice: $'.$this ->animalsPrice.'
'; echo 'waterPrice: $'.$this ->waterPrice.'
'; echo '
'; } }