Files
Activit-2/Pack/ZeMain.java
2025-10-07 16:36:07 +02:00

60 lines
1.2 KiB
Java

package Pack;
public class ZeMain {
public static void main(String[] args) {
System.out.println("bonjour.\n");
Responsable r1 = new Responsable("bob",15);
Responsable r2 = new Responsable("Richard", 19);
Ouverture ouv1 = new Ouverture("ouv 01", 90, r1);
Ouverture ouv2 = new Ouverture("ouv 02", 70, r1);
Ouverture ouv3 = new Ouverture("ouv 03", 50, r2);
Ouverture ouv4 = new Ouverture("ouv 04", 180, r2);
Salle salle1 = new Salle("S001");
salle1.ajouterOuverture(ouv1);
salle1.ajouterOuverture(ouv2);
Amphi amphi1 = new Amphi("A123",500);
amphi1.ajouterOuverture(ouv3);
amphi1.ajouterOuverture(ouv4);
Batiment bat1 = new Batiment("batiment 1");
bat1.ajouterSalle(salle1);
bat1.ajouterSalle(amphi1);
try {
bat1.ajouterSalle(null);
}catch(Exception e) {
System.out.println("Exception : " + e.getMessage());
System.out.println("on continue");
}
System.out.println("\n------- test salle 1 ------");
salle1.afficherInfos();
System.out.println("\n------- test amphi 1 -------");
amphi1.afficherInfos();
System.out.println("\n\n----- test batiment 1 ------");
bat1.afficherInfos();
bat1.ajouterSalle(null);
System.out.println("\n\nFin");
}
}