<?php require_once 'autoload.php'; $person = new Person('Nikol', 121213048, false, 500000); $person2 = new Person('Ivan', 12123048, true, 200000); $car = new Car('Honda Accord', 36000, true, 'white', 260); $car2 = new Car('Nissan GTR', 150000, true, 'black', 320); $carShop = new CarShop(); $carShop->addCar($car); $carShop->addCar($car2); echo ' The price of the ' . $car->getModel() . ' for scrap is ' . $car->calculatePriceForScrap(10000) . '.', PHP_EOL; echo $person->buyCar($car2), PHP_EOL; echo 'After buying a new ' . $person->getCar()->getModel() . ', ' . $person->getName() . ' has ' . $person->getMoney() . ' money left.', PHP_EOL; echo 'After selling the car for scrap, ' . $person->getName() . ' has ' . $person->sellCarForScrap(15000) . ' money left.', PHP_EOL; $car2->changeOwner($person2); echo 'The new owner of the ' . $car2->getModel() . ' is: ' . $car2->getOwner()->getInfo();
<?php require_once 'autoload.php'; $car1 = new Car('BMW', true, 'black', 340000, 250); $car1->setCurrentSpeed(100); $car1->setCurrentGear(4); $car2 = new Car('Audi', false, 'grey', 280000, 260); $car2->setCurrentSpeed(150); $car2->setCurrentGear(5); echo "Gear is: ", $car1->getCurrentGear(), " and the speed is: ", $car1->getCurrentSpeed(), PHP_EOL; $car1->changeGear(5); $car1->accelerate(); echo "Now the gear is: ", $car1->getCurrentGear(), " and the speed is: ", $car1->getCurrentSpeed(), PHP_EOL; $shop = new CarShop(); $shop->addCar($car1); $shop->addCar($car2); $shop->showAllCarsInTheShop();
//$car1->changeGearUp(); //echo 'Current gear is ' . $car1->getCurrentGear(), PHP_EOL; // //$car1->changeGearDown(); //echo 'Current gear is ' . $car1->getCurrentGear(), PHP_EOL; // //$car1->changeGear(2); //echo 'Current gear is ' . $car1->getCurrentGear(), PHP_EOL; // //$car1->changeColor('blue'); //echo 'Current color is ' . $car1->getColor(), PHP_EOL; $car11 = new Car('Mazda', true, 'brown', 50000, 350); $car12 = new Car('Suzuki', true, 'blue', 40000, 300); $car13 = new Car('Hyundai', false, 'pink', 30000, 250); $car14 = new Car('Mazda', true, 'brown', 50000, 350); $buyer1 = new Person('Georgi', 8956456231, true); $buyer1->setMoney(50000); $carShop = new CarShop($car11, $car12); $carShop->addCar($car13); $carShop->addCar($car14); print_r($carShop->getNextCar()); $carShop->sellNextCar($buyer1); $carShop->removeCar($car11); $carShop->showAllCarsInTheShop(); print_r($buyer1); print_r($carShop->getNextCar()); print_r($carShop->getNextCar()); print_r($carShop->getNextCar()); print_r($carShop->getNextCar()); $carShop->addCar($car11); $carShop->showAllCarsInTheShop();