All pastes #896889 Raw Edit

Miscellany

public java v1 · immutable
·published 2008-02-09 00:54 UTC
rendered paste body
public class      Matiere{  private int     numero;  private String  intitule;    /*   ** Constructeur   */  public Matiere (int numero, String intitule)  {    this.intitule = intitule;    this.prix = prix;  }    /*   ** Accesseur pour numero   */  public int getNumero()  {    return this.numero;  }    /*   ** Mutateur pour numero   */  public void setNumero(int n)  {    this.numero = n;  }    /*   ** Accesseur pour intitule   */  public int getIntitule()  {    return this.intitule;  }    /*   ** Mutateur pour intitule   */  public void setIntitule(String intitule)  {    this.intitule = intitule;  }  }public class ListeMatieres{  private int        numero;  private String     intitule;  private ArrayList  liste;    /*   ** Constructeur   */  public ListeMatieres (int num, String intitule, int taille)  {    this.numero = num;    this.intitule = intitule;    this.liste = new ArrayList();  }    /*   ** Accesseur pour numero   */  public int getNumero()  {    return this.numero;  }    /*   ** Mutateur pour numero   */  public void setNumero(int n)  {    this.numero = n;  }    /*   ** Accesseur pour intitule   */  public int getIntitule()  {    return this.intitule;  }    /*   ** Mutateur pour intitule   */  public void setIntitule(String intitule)  {    this.intitule = intitule;  }    /*   ** Ajout d'une matiere  */  public int ajoutMatiere(Matiere matiere)  {    return this.liste.add(matiere);  }    /*   ** Lister les matieres  **  ** Parcours les elements de la liste et affiche l'intitule  */  public void afficheListe()  {    int i;        for (i = 0; i < this.liste.size(); i++)    {      System.out.println(this.liste.get(i).getIntitule() + "\n");    }  }  }