-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathVehicle.php
More file actions
108 lines (101 loc) · 2.96 KB
/
Vehicle.php
File metadata and controls
108 lines (101 loc) · 2.96 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php
namespace ClassyTransport;
abstract class Vehicle{
protected $make;
protected $model;
protected $doors;
protected $windows;
protected $tires;
protected $width;
protected $height;
protected $length;
protected $engine = array('Horsepower' => int, 'NumOfCylinders' => int, 'FuelType' => string);
protected $driveType = array('Front Wheel' => bool, 'Rear Wheel' => bool, 'All Wheel' => bool);
public function __construct(
string $make,
string $model,
int $width,
int $height,
int $length,
int $horsepower,
int $numOfCylinders,
string $fuelType,
string $driveType,
string $doors = 'standard',
string $windows = 'standard',
string $tires = 'standard'
) {
$this->make = $make;
$this->model = $model;
$this->width = $width;
$this->height = $height;
$this->length = $length;
$this->engine['Horsepower'] = $horsepower;
$this->engine['NumOfCylinders'] = $numOfCylinders;
$this->engine['FuelType'] = $fuelType;
$this->driveType['Front Wheel'] = $this->checkFW($driveType);
$this->driveType['Rear Wheel'] = $this->checkRW($driveType);
$this->driveType['All Wheel'] = $this->checkAW($driveType);
$this->doors = $doors;
$this->windows = $windows;
$this->tires = $tires;
}
//Properties to get protected data members
public function getMake(): string {
return $this->make;
}
public function getModel(): string {
return $this->model;
}
public function getWidth(): string {
return $this->width;
}
public function getHeight(): string {
return $this->height;
}
public function getLength(): string {
return $this->length;
}
public function getDoors(): string {
return $this->doors;
}
public function getWindows(): string {
return $this->windows;
}
public function getTires(): string {
return $this->tires;
}
public function getEngine(): array {
return $this->engine;
}
public function getDriveType(): array {
return $this->driveType;
}
public function setDriveType(): array {
$this->driveType['Front Wheel'] = $driveType['Front Wheel'];
$this->driveType['Rear Wheel'] = $driveType['Rear Wheel'];
$this->driveType['All Wheel'] = $driveType['All Wheel'];
}
public function checkFW($driveType): bool {
if($driveType == 'Front Wheel'){
return true;
} else {
return false;
}
}
public function checkRW($driveType): bool {
if($driveType == 'Rear Wheel'){
return true;
} else {
return false;
}
}
public function checkAW($driveType): bool {
if($driveType == 'All Wheel'){
return true;
} else {
return false;
}
}
}
?>