From bc1c9156edb2790204f1a7f57a917eca26af7b7a Mon Sep 17 00:00:00 2001 From: arthur Date: Tue, 7 Oct 2025 16:36:07 +0200 Subject: [PATCH] =?UTF-8?q?Init=20de=20mon=20d=C3=A9p=C3=B4t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Pack/Amphi.java | 55 ++++++++++++++++++++++++++++++++++ Pack/Batiment.java | 55 ++++++++++++++++++++++++++++++++++ Pack/Fenetre.java | 14 +++++++++ Pack/GestionTravaux.java | 17 +++++++++++ Pack/Ouverture.java | 64 ++++++++++++++++++++++++++++++++++++++++ Pack/Responsable.java | 27 +++++++++++++++++ Pack/Salle.java | 49 ++++++++++++++++++++++++++++++ Pack/Technicien.java | 54 +++++++++++++++++++++++++++++++++ Pack/ZeMain.java | 59 ++++++++++++++++++++++++++++++++++++ 9 files changed, 394 insertions(+) create mode 100644 Pack/Amphi.java create mode 100644 Pack/Batiment.java create mode 100644 Pack/Fenetre.java create mode 100644 Pack/GestionTravaux.java create mode 100644 Pack/Ouverture.java create mode 100644 Pack/Responsable.java create mode 100644 Pack/Salle.java create mode 100644 Pack/Technicien.java create mode 100644 Pack/ZeMain.java diff --git a/Pack/Amphi.java b/Pack/Amphi.java new file mode 100644 index 0000000..7a2502a --- /dev/null +++ b/Pack/Amphi.java @@ -0,0 +1,55 @@ +package Pack; +import java.util.*; + +import Pack.Salle; + +public class Amphi extends Salle { + + + private ArrayList sallesVoisines; + private int hauteurSousPlafond; + + + + public Amphi() { + sallesVoisines = new ArrayList(); + hauteurSousPlafond = 0; + } + + public Amphi(String numSalle, int ht) { + setNumero(numSalle); + sallesVoisines = new ArrayList(); + hauteurSousPlafond = ht; + } + + + public void afficherInfos() { + System.out.println("Amphi :"); + super.afficherInfos(); + System.out.print("Liste des salles voisines : "); + for (Salle s : sallesVoisines) { + System.out.println(s.getNumero()+". "); + } + + } + + + + public void ajouterVoisine(Salle sa) { + sallesVoisines.add(sa); + } + + public void supprimerOuverture(Salle sa) { + sallesVoisines.remove(sa); + } + public int getHauteurSousPlafond() { + return hauteurSousPlafond; + } + + public void setHauteurSousPlafond(int hauteurSousPlafond) { + this.hauteurSousPlafond = hauteurSousPlafond; + } + + + +} \ No newline at end of file diff --git a/Pack/Batiment.java b/Pack/Batiment.java new file mode 100644 index 0000000..1d3e87e --- /dev/null +++ b/Pack/Batiment.java @@ -0,0 +1,55 @@ +package Pack; + +import java.util.ArrayList; + +import Pack.Salle; + +public class Batiment { + + + private String nom; + private ArrayList listeSalles; + + + + public Batiment() { + listeSalles = new ArrayList(); + nom = "NC"; + } + + public Batiment(String n) { + listeSalles = new ArrayList(); + nom = n; + } + + + + public void afficherInfos() { + System.out.println("Batiment :" + nom); + System.out.print("Liste des salles : "); + for (Salle s : listeSalles) { + s.afficherInfos(); + } + + } + + public void ajouterSalle(Salle s) { + if (s==null) throw(new IllegalArgumentException("La salle ne doit pas ĂȘtre 'null'.")); + listeSalles.add(s); + } + + public void supprimerSalle(Salle s) { + listeSalles.remove(s); + } + + public String getNom() { + return nom; + } + + public void setNom(String nom) { + this.nom = nom; + } + + + +} \ No newline at end of file diff --git a/Pack/Fenetre.java b/Pack/Fenetre.java new file mode 100644 index 0000000..03d4e01 --- /dev/null +++ b/Pack/Fenetre.java @@ -0,0 +1,14 @@ +package Pack; + +import Pack.Ouverture; + +public class Fenetre extends Ouverture { + + private Boolean doubleVitrage; + + public Boolean aDoubleVitrage() { + // TODO - implement Fenetre.aDoubleVitrage + throw new UnsupportedOperationException(); + } + +} \ No newline at end of file diff --git a/Pack/GestionTravaux.java b/Pack/GestionTravaux.java new file mode 100644 index 0000000..12f2469 --- /dev/null +++ b/Pack/GestionTravaux.java @@ -0,0 +1,17 @@ +package Pack; + +import java.util.*; + +import Pack.Ouverture; +import Pack.Technicien; + +public class GestionTravaux { + + + private ArrayList listeBatiments; + + private ArrayList listeOuvertures; + + private ArrayList listeTechiniciens; + +} \ No newline at end of file diff --git a/Pack/Ouverture.java b/Pack/Ouverture.java new file mode 100644 index 0000000..a4f2206 --- /dev/null +++ b/Pack/Ouverture.java @@ -0,0 +1,64 @@ +package Pack; + +import Pack.Responsable; + +public class Ouverture { + + + + private Responsable superviseur; + private int largeur; + private String numeroSerie; + + + public Ouverture() { + largeur = 0; + numeroSerie="NC"; + } + + public Ouverture(String numS, int larg, Responsable s) { + largeur = larg; + numeroSerie = numS; + superviseur = s; + } + + + + public void afficherInfos() { + System.out.println("Ouverture : " + numeroSerie); + System.out.println(" largeur : "+ largeur); + + if (superviseur!=null) { + System.out.println(" superviseur : "+ superviseur.getNom()); + } else { + System.out.println(" superviseur : NC" ); + } + } + + + + public Responsable getSuperviseur() { + return superviseur; + } + + public void setSuperviseur(Responsable superviseur) { + this.superviseur = superviseur; + } + + public int getLargeur() { + return largeur; + } + + public void setLargeur(int largeur) { + this.largeur = largeur; + } + + public String getNumeroSerie() { + return numeroSerie; + } + + public void setNumeroSerie(String numeroSerie) { + this.numeroSerie = numeroSerie; + } + +} \ No newline at end of file diff --git a/Pack/Responsable.java b/Pack/Responsable.java new file mode 100644 index 0000000..bb0c671 --- /dev/null +++ b/Pack/Responsable.java @@ -0,0 +1,27 @@ +package Pack; +import java.util.*; + +import Pack.Technicien; + +public class Responsable extends Technicien { + + + private ArrayList listeSupervisions; + + + public Responsable() { + listeSupervisions = new ArrayList(); + } + + public Responsable(String n,int exp) { + listeSupervisions = new ArrayList(); + setNom(n); + setAnneesExperience(exp); + } + + public void getFicheInfo() { + // TODO - implement Responsable.getFicheInfo + throw new UnsupportedOperationException(); + } + +} \ No newline at end of file diff --git a/Pack/Salle.java b/Pack/Salle.java new file mode 100644 index 0000000..936dfb7 --- /dev/null +++ b/Pack/Salle.java @@ -0,0 +1,49 @@ +package Pack; + +import java.util.ArrayList; + +public class Salle { + + + private String numero; + private ArrayList listeOuvertures; + + + public Salle() { + listeOuvertures = new ArrayList(); + numero = "NC"; + } + + public Salle(String num) { + listeOuvertures = new ArrayList(); + numero = num; + } + + public void afficherInfos() { + System.out.println("Salle numero : " + numero); + System.out.println("Ouvertures : "); + for (Ouverture ouv : listeOuvertures) { + ouv.afficherInfos(); + } + } + + + public void ajouterOuverture(Ouverture ouv) { + listeOuvertures.add(ouv); + } + + public void supprimerOuverture(Ouverture ouv) { + listeOuvertures.remove(ouv); + } + + public String getNumero() { + return numero; + } + + + public void setNumero(String numero) { + this.numero = numero; + } + + +} \ No newline at end of file diff --git a/Pack/Technicien.java b/Pack/Technicien.java new file mode 100644 index 0000000..bf929ba --- /dev/null +++ b/Pack/Technicien.java @@ -0,0 +1,54 @@ +package Pack; +import java.util.*; + +public class Technicien { + + private ArrayList listeOuvertures; + private String nom; + private int anneesExperience; + + + + public Technicien () { + listeOuvertures = new ArrayList(); + nom = "NC"; + anneesExperience = 0; + } + + public Technicien(String n, int exp) { + listeOuvertures = new ArrayList(); + nom = n; + anneesExperience = exp; + } + + public void getFicheInfo() { + // TODO - implement Technicien.getFicheInfo + throw new UnsupportedOperationException(); + } + + public ArrayList getListeOuvertures() { + return listeOuvertures; + } + + public void setListeOuvertures(ArrayList listeOuvertures) { + this.listeOuvertures = listeOuvertures; + } + + public String getNom() { + return nom; + } + + public void setNom(String nom) { + this.nom = nom; + } + + public int getAnneesExperience() { + return anneesExperience; + } + + public void setAnneesExperience(int anneesExperience) { + this.anneesExperience = anneesExperience; + } + + +} \ No newline at end of file diff --git a/Pack/ZeMain.java b/Pack/ZeMain.java new file mode 100644 index 0000000..a41ad60 --- /dev/null +++ b/Pack/ZeMain.java @@ -0,0 +1,59 @@ +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"); + + + } + +}