Advertisement
bastide

Test de l'exercice "Garage"

Nov 26th, 2014
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. public class testVoiture {
  2.  
  3.     public static void main(String[] args) throws Exception {
  4.         Voiture v = new Voiture("193 XR 31");
  5.         Garage albi = new Garage("CUFR Champollion, Albi");
  6.         Garage castres = new Garage("ISIS, Castres");
  7.  
  8.         v.entreAuGarage(castres);
  9.         Thread.sleep(2000); // attendre 2 secondes
  10.         v.sortDuGarage();
  11.         Thread.sleep(2000); // attendre 2 secondes
  12.         v.entreAuGarage(albi);
  13.         Thread.sleep(2000); // attendre 2 secondes
  14.         v.sortDuGarage();
  15.         Thread.sleep(2000); // attendre 2 secondes
  16.         v.entreAuGarage(castres);
  17.         System.out.printf("La voiture : %s est elle dans un garage? %b\n", v,  v.estDansUnGarage());
  18.         // -> true
  19.         Thread.sleep(2000); // attendre 2 secondes
  20.         v.sortDuGarage();
  21.         //v.sortDuGarage();
  22.         // -> Exception : déjà sortie
  23.  
  24.         v.imprimeGaragesVisites();
  25.     }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement