include_once 'Bicicleta.php';
include_once 'Coche.php';
$cocheDeLuis = new Coche("Saab", "93", "2540CKF");
$cocheDeJuanK = new Coche("Toyota", "Avensis", "4022GVV");
$bicidePedro = new Bicicleta("Monty", "road", "10");
$cocheDeLuis->recorre(30);
$cocheDeLuis->recorre(220);
$cocheDeJuanK->recorre(60);
$cocheDeJuanK->recorre(90);
$bicidePedro->recorre(2);
echo "<br>";
echo $bicidePedro->caballito();
echo "<br>";
echo "El coche de Luis ha recorrido " . $cocheDeLuis->getKilometraje() . "Km<br>";
echo "El coche de Juan Carlos ha recorrido " . $cocheDeJuanK->getKilometraje() . "Km<br>";
echo "La bici de Pedro ha recorrido " . $bicidePedro->getKilometraje() . "Km<br>";
echo "<br>";
echo "KILOMETRAJE TOTAL: " . Vehiculo::getKmTotales() . "Km<br>";
echo "NUMERO VEHICULOS CREADOS: " . Vehiculo::getVehiculosCreados() . "<br>";
echo $cocheDeJuanK;
echo $cocheDeLuis;
echo $bicidePedro;
?>
  </body> 
</html>





Beispiel #2
0
$biciDos->anda(40);
$biciUno->anda(220);
$biciDos->anda(60);
$cocheUno->anda(200);
$cocheDos->anda(150);
$cocheUno->anda(300);
$cocheDos->anda(500);
echo $cocheUno . "<br><br>";
echo $cocheDos . "<br><br>";
echo $biciUno . "<br><br>";
echo $biciDos . "<br><br>";
echo "*************************BICICLETAS*****************************<br>";
echo "La biciUno ha recorrido " . $biciUno->getKilometraje() . "Km<br>";
echo $biciUno->caballito() . " BiciUno" . "<br>";
echo $biciUno->montaB() . " BiciUno" . "<br><br>";
echo "La biciDos ha recorrido " . $biciDos->getKilometraje() . "Km<br>";
echo $biciDos->caballito() . " BiciDos" . "<br>";
echo $biciDos->montaB() . " BiciDos" . "<br><br>";
echo "****************************COCHES******************************<br>";
echo "El cocheUno ha recorrido " . $cocheUno->getKilometraje() . "Km<br>";
echo $cocheUno->quema() . " cocheUno" . "<br>";
echo $cocheUno->montaC() . " cocheUno" . "<br><br>";
echo "El cocheDos ha recorrido " . $cocheDos->getKilometraje() . "Km<br>";
echo $cocheDos->quema() . " cocheDos" . "<br>";
echo $cocheDos->montaC() . " cocheDos" . "<br><br>";
echo "**************************KILOMETRAJE***************************<br>";
echo "El kilometraje total ha sido de " . Vehiculo::getkmTotales() . "Km<br><br>";
echo "****************************CONTADOR****************************<br>";
echo "Número de coches y bicicletas: ";
echo Vehiculo::getnumVehiculos();
?>