@@ -0,0 +1,1894 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage tpyak;%0A%0Aimport java.util.ArrayList;%0A%0A/**%0A *%0A * @author Atef%0A */%0Apublic class Adherent %7B%0A%0A%09private static int compteurAdherent = 1;%0A%09private String nom;%0A%09private String prenom;%0A%09private String adresse;%0A%09private int noAdherent;%0A%09private ArrayList%3CArticle%3E articlesEmpruntes = new ArrayList%3CArticle%3E();%0A%0A%09public Adherent(String nom, String prenom, String adresse) %7B%0A%09%09this.nom = nom;%0A%09%09this.prenom = prenom;%0A%09%09this.noAdherent = Adherent.compteurAdherent;%0A%09%09Adherent.compteurAdherent++;%0A%09%7D%0A%0A%09@Override%0A%09public String toString() %7B%0A%09%09String s = String.format(%22Adherent %7BnoAdherent: %25d, nom: %25s, prenom: %25s, adresse: %25s, articlesEmpruntes: %5B%5Cn%22, noAdherent, nom, prenom, adresse, articlesEmpruntes);%0A%09%09for (Article article : articlesEmpruntes) %7B%0A%09%09%09s += String.format(%22%7B%5Cn%25s%7D, %22, article.getDescription(true));%0A%09%09%7D%0A%09%09s = s.substring(0, s.length() - 2);%0A%09%09s += %22%5Cn%5D%7D%22;%0A%09%09return s;%0A%09%7D%0A%0A%09public void emprunter(Article article) %7B%0A%09%09if (article != null && article.getEmprunteur() == null) %7B%0A%09%09%09article.setEmprunteur(this);%0A%09%09%09articlesEmpruntes.add(article);%0A%09%09%7D%0A%09%7D%0A%0A%09public void rendre(Article article) %7B%0A%09%09if (article != null) %7B%0A%09%09%09article.setEmprunteur(null);%0A%09%09%09articlesEmpruntes.remove(article);%0A%09%09%7D%0A%09%7D%0A%0A%09public ArrayList%3CArticle%3E emprunts() %7B%0A%09%09return articlesEmpruntes;%0A%09%7D%0A%0A%09public String getNom() %7B%0A%09%09return nom;%0A%09%7D%0A%0A%09public String getPrenom() %7B%0A%09%09return prenom;%0A%09%7D%0A%0A%09public String getAdresse() %7B%0A%09%09return adresse;%0A%09%7D%0A%0A%09public void setAdresse(String adresse) %7B%0A%09%09this.adresse = adresse;%0A%09%7D%0A%0A%09public int getNoAdherent() %7B%0A%09%09return noAdherent;%0A%09%7D%0A%0A%09@Override%0A%09public void finalize() throws Throwable %7B%0A%09%09super.finalize();%0A%09%09System.out.println(this.getClass().getName()+%22 Objet nettoy%C3%A9 de la m%C3%A9moire%22);%0A%09%7D%0A%0A%7D%0A

Create Adherent.java