init commint

This commit is contained in:
2025-10-07 16:55:57 +02:00
commit 71c8673b63
11 changed files with 341 additions and 0 deletions

20
Amphi.java Normal file
View File

@@ -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);
}
}

33
Batiment.java Normal file
View File

@@ -0,0 +1,33 @@
package Monpack2;
import java.util.ArrayList;
public class Batiment {
private int nom;
private ArrayList<Salle> 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<Salle> getSalles() {
return salles;
}
}

41
Fenetre.java Normal file
View File

@@ -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 );
}
}

5
GestionBatiment.java Normal file
View File

@@ -0,0 +1,5 @@
package Monpack2;
public class GestionBatiment {
}

12
Intervention.java Normal file
View File

@@ -0,0 +1,12 @@
package Monpack2;
import java.util.ArrayList;
public class Intervention {
private ArrayList<Personnel> participants = new ArrayList<>();
public void ajouterParticipant(Personnel p) {
participants.add(p);
}
public ArrayList<Personnel> getParticipants() {
return participants;
}
}

51
Ouverture.java Normal file
View File

@@ -0,0 +1,51 @@
package Monpack2;
import java.util.ArrayList;
public class Ouverture {
private int largeur;
private String numeroSerie;
private ArrayList<Technicien> 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<Technicien> getTechniciens() {
return techniciens;
}
}

38
Personnel.java Normal file
View File

@@ -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<Personnel> getPersonnelsNonIntervenus(ArrayList<Personnel> personnels, ArrayList<Intervention> interventions) {
ArrayList<Personnel> 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);
}
}

24
Responsable.java Normal file
View File

@@ -0,0 +1,24 @@
package Monpack2;
import java.util.ArrayList;
public class Responsable extends Personnel {
public Responsable(String nom) {
super(nom);
}
ArrayList<Responsable> listeResponsable = new ArrayList<Responsable>();
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());
}
}
}

56
Salle.java Normal file
View File

@@ -0,0 +1,56 @@
package Monpack2;
import java.util.ArrayList;
public class Salle {
private int numero;
public ArrayList<Ouverture> listeOuvertures = new ArrayList<Ouverture>();
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<Ouverture> getOuverturesAvecPlusDeKTechniciens(int k) {
ArrayList<Ouverture> 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();
}
}

24
Technicien.java Normal file
View File

@@ -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<Technicien> listeTechnicien = new ArrayList<Technicien>();
for(Technicien technicienCourant : listeTechnicien) {
System.out.println("Nom: " + technicienCourant.getNom() + ", Années d'expérience: " + technicienCourant.getAnneesExperience());
}
}

37
main.java Normal file
View File

@@ -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("**************");
}
}