Exemplo n.º 1
0
 public function __construct()
 {
     parent::__construct(self::className, self::classPrice);
     $this->equipCar();
 }
<?php

require_once "Automobile.php";
$make = 'vw';
$model = 'bug';
$color = 'papayawhip';
$car1 = new Automobile($make, $model, $color);
echo $car1->getDescription() . PHP_EOL;
$yourCar = new Automobile('audi', 'zippy-fast', 'pink');
echo $yourCar->getDescription() . PHP_EOL;
Exemplo n.º 3
0
    public $make;
    public $model;
    public $color;
    public function honk()
    {
        return 'BEEP BEEP';
    }
    public function accelerate()
    {
        return $this->increaseFuelAirMixture;
    }
    public function increaseFuelAirMixture()
    {
        // api to the fuel injection
    }
    public function brake()
    {
        return $this->engageBrakePads;
    }
    public function engageBrakePads()
    {
        //api to the brake pads
    }
}
// end of Automobile
$newcar = new Automobile();
$newcar->make = 'Dodge';
$newcar->model = 'Challenger';
$newcar->color = 'Jet Black';
$newcar->brake();
var_dump($newcar);
Exemplo n.º 4
0
<?php

require 'classes.php';
$auto = new Automobile();
$model = new BaseAutomobileModel();
$model = new SportAutomobileModel($model);
$model = new TouringAutomobileModel($model);
$auto->setModel($model);
$auto->printDescription();
Exemplo n.º 5
0
<?php

require_once "Automobile.php";
$make = 'vw';
$model = 'bug';
$color = "papayawhip";
$car1 = new Automobile($make, $model, $color);
echo $car1->getDescription();
$yourCar = new Automobile('audi', 'A4', 'pink');
echo $yourCar->getDescription();
die;
Exemplo n.º 6
0
 public function calcVehiclePriceWithDiscount(Automobile $car)
 {
     $finalPrice = $car->calculatePrice();
     foreach ($this->discountOptions as $option) {
     }
 }
Exemplo n.º 7
0
<?php

require_once "Automobile.php";
$make = "vw";
$model = "bug";
$color = "blue";
$car1 = new Automobile($make, $model, $color);
echo $car1->getDescription();