commit 71c8673b63a18efb9ae73d433b580607beed3f89 Author: isma9533 Date: Tue Oct 7 16:55:57 2025 +0200 init commint diff --git a/Amphi.java b/Amphi.java new file mode 100644 index 0000000..8da1d85 --- /dev/null +++ b/Amphi.java @@ -0,0 +1,20 @@ +package Monpack2; + +public class Amphi extends Salle { +private int hauteurSousPlafond; +public int getHauteurSousPlafond() { + return hauteurSousPlafond; + +} +public void setHauteurSousPlafond(int hauteurSousPlafond) { + this.hauteurSousPlafond = hauteurSousPlafond; +} +public void afficherInfos() { + System.out.println("Amphi : "); + super.afficherInfosOuvertures();//appel de la méthode de la classe mère + + System.out.println("Hauteur sous plafond : " + hauteurSousPlafond); +} + + +} \ No newline at end of file diff --git a/Batiment.java b/Batiment.java new file mode 100644 index 0000000..8f2ba97 --- /dev/null +++ b/Batiment.java @@ -0,0 +1,33 @@ +package Monpack2; +import java.util.ArrayList; + +public class Batiment { + + private int nom; + private ArrayList salles= new ArrayList<>(); + + public int getNom() { + return nom; + } + + public void setNom(int nom) { + this.nom = nom; + } + + public void ajouterSalle(Salle s) { + salles.add(s); + } + + public ArrayList getSalles() { + return salles; + } + + + + + } + + + + + diff --git a/Fenetre.java b/Fenetre.java new file mode 100644 index 0000000..0333764 --- /dev/null +++ b/Fenetre.java @@ -0,0 +1,41 @@ +package Monpack2; +public class Fenetre extends Ouverture { + + private int doubleVitrage; + public Fenetre(int lg , String ns, boolean dv) { + super(lg,ns); + if (dv) { + doubleVitrage = 1; + } else { + doubleVitrage = 0; + } + // + + + } + public Fenetre( ) { + + super(-1,"non defini"); + // + } + public void aDoubleVitrage() { + // TODO - implement Fenetre.aDoubleVitrage + throw new UnsupportedOperationException(); + } + + public int getDoubleVitrage() { + return doubleVitrage; + } + + public void setDoubleVitrage(int doubleVitrage) { + this.doubleVitrage = doubleVitrage; + } + public void afficherInfos() { + // TODO - implement Ouverture.afficherInfos + //throw new UnsupportedOperationException(); + super.afficherInfos(); + super.afficherInfos(); + System.out.println(" Double vitrage ? " +doubleVitrage ); + + } + } diff --git a/GestionBatiment.java b/GestionBatiment.java new file mode 100644 index 0000000..2405385 --- /dev/null +++ b/GestionBatiment.java @@ -0,0 +1,5 @@ +package Monpack2; + +public class GestionBatiment { + +} diff --git a/Intervention.java b/Intervention.java new file mode 100644 index 0000000..b9521e3 --- /dev/null +++ b/Intervention.java @@ -0,0 +1,12 @@ +package Monpack2; +import java.util.ArrayList; + +public class Intervention { + private ArrayList participants = new ArrayList<>(); + public void ajouterParticipant(Personnel p) { + participants.add(p); + } + public ArrayList getParticipants() { + return participants; + } +} diff --git a/Ouverture.java b/Ouverture.java new file mode 100644 index 0000000..66deca5 --- /dev/null +++ b/Ouverture.java @@ -0,0 +1,51 @@ +package Monpack2; +import java.util.ArrayList; + +public class Ouverture { + + + + + private int largeur; + private String numeroSerie; + private ArrayList techniciens = new ArrayList<>(); + + public Ouverture(int lg , String ns) { + largeur = lg; + numeroSerie = ns; + } + public Ouverture() { + largeur = -1; + numeroSerie = "non defini"; + + } + public void afficherInfos() { + // TODO - implement Ouverture.afficherInfos + //throw new UnsupportedOperationException(); + System.out.println("Largeur : " + largeur + " Numéro de série : " + numeroSerie); + } + + 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; + } + + public void ajouterTechnicien(Technicien t) { + techniciens.add(t); + } + + public ArrayList getTechniciens() { + return techniciens; + } +} \ No newline at end of file diff --git a/Personnel.java b/Personnel.java new file mode 100644 index 0000000..bbeff0d --- /dev/null +++ b/Personnel.java @@ -0,0 +1,38 @@ +package Monpack2; + +import java.util.ArrayList; + +public class Personnel { + private String nom; + public Personnel(String nom) { + this.nom = nom; + } + public String getNom() { + return nom; + } + public void setNom(String nom) { + this.nom = nom; + } + public static ArrayList getPersonnelsNonIntervenus(ArrayList personnels, ArrayList interventions) { + ArrayList result = new ArrayList<>(); + for (Personnel p : personnels) { + boolean intervenu = false; + for (Intervention i : interventions) { + if (i.getParticipants().contains(p)) { + intervenu = true; + break; + } + } + if (!intervenu) { + result.add(p); + } + } + return result; + } + public void afficherInfos() { + // TODO Auto-generated method stub + System.out.println("Nom : " + nom); + + + } +} \ No newline at end of file diff --git a/Responsable.java b/Responsable.java new file mode 100644 index 0000000..59c25f1 --- /dev/null +++ b/Responsable.java @@ -0,0 +1,24 @@ +package Monpack2; +import java.util.ArrayList; + +public class Responsable extends Personnel { + public Responsable(String nom) { + super(nom); + } + ArrayList listeResponsable = new ArrayList(); + Responsable responsableCourant1 = new Responsable("Dupont"); + Responsable responsableCourant2 = new Responsable("Durand"); + + public void ajouterResponsable(Responsable r) { + listeResponsable.add(r); + } + public void afficherResponsables() { + for (Responsable r : listeResponsable) { + System.out.println(r.getNom()); + } + } + + + + +} diff --git a/Salle.java b/Salle.java new file mode 100644 index 0000000..7308122 --- /dev/null +++ b/Salle.java @@ -0,0 +1,56 @@ +package Monpack2; + +import java.util.ArrayList; + +public class Salle { + + private int numero; + public ArrayList listeOuvertures = new ArrayList(); + public void afficherInfosOuvertures() { + // TODO - implement Salle.afficherInfosOuvertures + //throw new UnsupportedOperationException(); + for(Ouverture OuvertureCourantes: listeOuvertures) { + OuvertureCourantes.afficherInfos(); + } + } + public void ajouterOuverture(Ouverture Ouv) { + listeOuvertures.add(Ouv); + + } + + public int getNumero() { + return numero; + } + + public void setNumero(int numero) { + this.numero = numero; + } + + public ArrayList getOuverturesAvecPlusDeKTechniciens(int k) { + ArrayList result = new ArrayList<>(); + for (Ouverture o : listeOuvertures) { + if (o.getTechniciens().size() > k) { + result.add(o); + } + } + return result; + } + + public int getSommeLargeurOuverturesParTechnicien(Technicien t) { + int somme = 0; + for (Ouverture o : listeOuvertures) { + if (o.getTechniciens().contains(t)) { + somme += o.getLargeur(); + } + } + return somme; + } + public void afficherInfos() { + // TODO - implement Salle.afficherInfos + //throw new UnsupportedOperationException(); + System.out.println("Numero de la salle: " + this.getNumero()); + System.out.println("Liste des ouvertures: "); + this.afficherInfosOuvertures(); + } + +} \ No newline at end of file diff --git a/Technicien.java b/Technicien.java new file mode 100644 index 0000000..4111d0b --- /dev/null +++ b/Technicien.java @@ -0,0 +1,24 @@ +package Monpack2; +import java.util.ArrayList; +public class Technicien extends Personnel { + + private int anneesExperience; + public Technicien(String nom, int anneesExperience) { + super(nom); + this.anneesExperience = anneesExperience; + } + public int getAnneesExperience() { + return anneesExperience; + } + public void setAnneesExperience(int anneesExperience) { + this.anneesExperience = anneesExperience; + } + + public ArrayList listeTechnicien = new ArrayList(); + + for(Technicien technicienCourant : listeTechnicien) { + System.out.println("Nom: " + technicienCourant.getNom() + ", Années d'expérience: " + technicienCourant.getAnneesExperience()); + } +} + + diff --git a/main.java b/main.java new file mode 100644 index 0000000..2ea657c --- /dev/null +++ b/main.java @@ -0,0 +1,37 @@ +package Monpack2; + +public class main { + + public static void main(String[] args) { + // TODO Auto-generated method stub + System.out.println("Hello world!"); + Amphi a1 = new Amphi(); + //a1.afficherInfosOuvertures(); + a1.setNumero(15); + System.out.println(a1.getNumero()); + Ouverture o1 = new Ouverture (90,"qbcs444"); + Ouverture o2 = new Ouverture(50,"abg152"); + a1.ajouterOuverture(o1); + a1.ajouterOuverture(o2); + a1.afficherInfosOuvertures(); + a1.setHauteurSousPlafond(600); + a1.afficherInfos(); + Fenetre f1 = new Fenetre(120,"fff555",true); + a1.ajouterOuverture(f1); + + a1.afficherInfos(); + System.out.println("**************"); + Fenetre f2 = new Fenetre(); + a1.ajouterOuverture(f2); + a1.afficherInfos(); + System.out.println("**************"); + + + } + + + + + + +}