Skip to content

Instantly share code, notes, and snippets.

@ilyeshammadi
Created May 5, 2015 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyeshammadi/40ae55e3828246eb8684 to your computer and use it in GitHub Desktop.
Save ilyeshammadi/40ae55e3828246eb8684 to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
import java.util.List;
/**
* Created by Ilyes Hammadi on 04/05/2015.
*/
public class Adherant extends Personne {
private int numeroAdherant;
private List<ArticleMediatheque> articles = new ArrayList<ArticleMediatheque>();
public Adherant(String nom, Adresse adresse) {
super(nom, adresse);
this.numeroAdherant = numeroAdherant;
this.articles = articles;
}
public List<ArticleMediatheque> getArticles() {
return articles;
}
public void setArticles(List<ArticleMediatheque> articles) {
this.articles = articles;
}
public int getNumeroAdherant() {
return numeroAdherant;
}
public void setNumeroAdherant(int numeroAdherant) {
this.numeroAdherant = numeroAdherant;
}
public void ajouterArticle(ArticleMediatheque articleMediatheque) {
articles.add(articleMediatheque);
}
public void afficherArticle() {
for (int i = 0; i < articles.size(); i++) {
System.out.println(i + 1 + ")" + articles.get(i).getTitre());
}
}
public ArticleMediatheque rendreArticle(int indice) {
return articles.get(indice);
}
public void supprimerArticle(int indice) {
articles.remove(indice);
}
public int nombreArticle() {
return articles.size();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment