예제 #1
0
파일: index.php 프로젝트: AnaHolgado/DWES
<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title></title>
  </head>
  <body>
    <?php 
include_once 'Vehiculo.php';
include_once 'Coche.php';
include_once 'Bicicleta.php';
$cocheDeLuis = new Coche("Saab", "93", "rojo");
$cocheDeJuanK = new Coche("Toyota", "Avensis", "verde");
$bicicletaJulieta = new Bicicleta("BTWIN", "RockRider 300", "2013");
$cocheDeJuanK->getMarca();
$cocheDeJuanK->getColor();
$bicicletaJulieta->getAnno();
$cocheDeLuis->anda(30);
$cocheDeLuis->getKmRecorridos();
$cocheDeJuanK->quemaRueda();
$cocheDeLuis->anda(40);
$cocheDeLuis->anda(220);
$bicicletaJulieta->anda(10);
$cocheDeLuis->quemaRueda();
$bicicletaJulieta->hacerCaballito();
$cocheDeJuanK->anda(60);
$cocheDeJuanK->anda(150);
$cocheDeJuanK->anda(90);
$bicicletaJulieta->anda(6);
echo "El coche de Luis ha recorrido " . $cocheDeLuis->getKmRecorridos() . "Km.<br>";
echo "El coche de Juan Carlos ha recorrido " . $cocheDeJuanK->getKmRecorridos() . "Km.<br>";
예제 #2
0
@author: Jesús Caballero Corpas
-->
<html>
  <head>
    <title>Capitulo 8 PHP POO - Ejercicio 4</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
  </head>
  <body>
    <div>
      <?php 
include_once 'Coche.php';
include_once 'Bicicleta.php';
$coche1 = new Coche("Peugeot", "206", "10");
echo "El " . $coche1->getMarca() . " " . $coche1->getModelo() . " " . $coche1->anda(20) . "<hr>";
echo $coche1->quemaRueda() . "<hr>";
echo $coche1->kilometros() . "<hr>";
echo $coche1 . "<hr>";
$bici1 = new Bicileta("Carreras", "5");
echo "La bicicleta " . $bici1->getModelo() . " " . $bici1->anda(20) . "<hr>";
echo $bici1->caballito() . "<hr>";
echo $bici1->kilometros() . "<hr>";
echo $bici1 . "<hr>";
echo "Vehiculos totales creados: " . Vehiculo::getVehiculosCreados() . "<hr>";
echo "Kilometros totales recorridos: " . Vehiculo::getKmTotales() . "<hr>";
?>
    </div>
  </body>
</html>