/
Building.php
52 lines (47 loc) · 1.82 KB
/
Building.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
class Building {
public $houseNumber;
public $floorCount;
public $porchCount;
public $apartmentCount;
public $nearestArea;
public $houseLights;
public $landPrice = 14;
public function __construct(){
$buildingOptions = AssBuilder::getBuildingOptions();
$this->houseNumber = $buildingOptions['houseNumberRand'];
if($buildingOptions['floorCountRand'] == 0){
$this->floorCount = 9;
} elseif($buildingOptions['floorCountRand'] == 1){
$this->floorCount = 12;
} else {
$this->floorCount = 16;
}
$this->porchCount = $buildingOptions['porchCountRand'];
$this->nearestArea = $this->floorCount * $this->porchCount * 4 * 20;
$this->houseLights = $this->floorCount * $this->porchCount * 10.5;
$apartmentCount = $this->floorCount * $this->porchCount * 4;
$this->apartmentCount($apartmentCount);
}
public function apartmentCount($number){
$arr = array();
for($i = 0; $i < $number; $i++){
$apartmentOptions = AssBuilder::getApartmentOptions();
$apartmentOptions['floorCount'] = $this->floorCount;
$arr[$i] = new Apartment($apartmentOptions);
}
$this->apartmentCount = $arr;
}
public function landTax(){
$land = ($this->porchCount * 40 + $this->nearestArea) * $this->landPrice;
return $land;
}
public function houseTax(){
$houseTaxes = 0;
foreach($this->apartmentCount as $value){
$houseTaxes += $value->allTaxes();
}
return $houseTaxes;
}
}
?>