コード例 #1
0
ファイル: index.php プロジェクト: AnaHolgado/DWES
    <?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>";
echo "La bicicleta de Julieta ha recorrido " . $bicicletaJulieta->getKmRecorridos() . "Km.<br>";
echo "El kilometraje total ha sido de " . Vehiculo::getKmTotales() . "Km<br>";
echo "Se han creado " . Vehiculo::getVehiculosCreados() . " vehiculos.";
?>
  </body>
</html>
コード例 #2
0
ファイル: index.php プロジェクト: AlbertoRD/Ejercicios-PHP
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
include_once './Vehiculo.php';
include_once './Bicicleta.php';
include_once './Coche.php';
$bicicleta = new Bicicleta();
$coche = new Coche();
$bicicleta->anda(20);
echo "He recorrido con la bicicleta " . $bicicleta->getKmRecorridos() . " km.<br/>";
echo $bicicleta->hacerCaballito() . "<br/>";
$coche->anda(30);
echo "He recorrido con el coche " . $coche->getKmRecorridos() . " km.<br/>";
echo $coche->quemarRueda() . "<br/>";
?>
    </body>
</html>