-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutomobile.php
More file actions
42 lines (34 loc) · 812 Bytes
/
Automobile.php
File metadata and controls
42 lines (34 loc) · 812 Bytes
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
<?php
class Automobile {
public $make;
public $model;
public $miles;
public $speed = 0;
public $uniqueIdentifier;
public $owner;
public $maxSpeed = 70;
public function setupAutomobile($make, $model, $owner)
{
$this->make = $make;
$this->model = $model;
$this->owner = $owner;
}
public function speedUp($increment)
{
return $this->speed = $this->speed + $increment;
}
public function applyBrakes($decrement)
{
return $this->speed = $this->speed - $decrement;
}
public function honk()
{
return "HONK HONK" . PHP_EOL;
}
public function screetchingHalt()
{
$currentSpeed = $this->speed;
$this->applyBrakes($currentSpeed);
return $this->honk();
}
}