/** Java class "Adherent.java" generated from Poseidon for UML. * Poseidon for UML is developed by Gentleware. * Generated with velocity template engine. */ package Pack_adherents; import java.util.*; /** *
* *
*/ public class Adherent { /////////////////////////////////////// // attributes /** ** Represents ... *
*/ private int numeroAdherent; /** ** Represents ... *
*/ private String nom; /** ** Represents ... *
*/ private String ville; /** ** Represents ... *
*/ private int anneeNaissance; /** ** Represente le montant de la cotisation (commun à tous les adherents) *
* */ private static int c_montantCotisation=45; /** ** Represente le montant actuellement verse par l'adherent *
* */ private int cotisationVersee; /////////////////////////////////////// // operations /** ** Does ... *
* * @return a String with ... *
*/ public String getNom() { // your code here return this.nom; } // end getNom /** ** Represents ... *
*/ public int getNumeroAdh() { return this.numeroAdherent; } // end getNumeroAdh /** ** Does ... *
* * @return a int with ... *
*/ public int getAge() { // your code here return 2005-anneeNaissance; } // end getAge /** ** Represents ... *
*/ public int getCotisationVersee() { return cotisationVersee; } // end getCotisationVersee /** ** * @return a boolean : l'adherent est ou non à jour de cotisation *
*/ public boolean aJour() { // your code here if (cotisationVersee>=c_montantCotisation) return true; else return false; } // end aJour /** ** Ajoute la somme passee en param au montant de la cotisation versee *
** * @return a boolean qui dit si l'adherent est a jour apres ce versement *
** @param versement montant de la somme versee *
*/ public boolean cotiser(int versement) { // your code here cotisationVersee+=versement; return aJour(); } // end cotiser /** ** * @return a String : "A jour" ou " PAS A JOUR !!!" *
*/ public String etat() { // your code here String etat; if (this.aJour()) etat = "a jour"; else etat = "PAS A JOUR !!!"; return etat; } // end etat /** ** Does ... *
* * @return a String with ... *
*/ public String toString() { // your code here return (getNumeroAdh()+" "+getNom()+" "+getVille()+" "+getAge()+" ans : a cotise : "+getCotisationVersee()+" "+etat()); } // end toString /** ** Does ... *
* *
* * @param args ... *
*/ public static void main(String[] args) { // your code here Adherent a1=new Adherent(1,"Dupont","Paris",1980); Adherent a2=new Adherent(2,"Meyer","Strasbourg",1955); Adherent a3=new Adherent(3,"Legwenn","Brest",1960); System.out.println (a1); System.out.println (a2); System.out.println (a3); System.out.println (); a1.cotiser(45); System.out.println (a1); System.out.println (a2); System.out.println (a3); System.out.println (); a2.cotiser(30); System.out.println (a1); System.out.println (a2); System.out.println (a3); System.out.println (); a3.cotiser(40); System.out.println (a1); System.out.println (a2); System.out.println (a3); System.out.println (); a2.cotiser(15); System.out.println (a1); System.out.println (a2); System.out.println (a3); } // end main /** ** Constructeur d'Adherent *
** * @return a Adherent *
** @param num ... *
** @param nom ... *
** @param vil ... *
** @param nss ... *
*/ public Adherent(int num, String nom, String vil, int nss) { // your code here this.numeroAdherent=num; this.nom=nom; this.ville=vil; this.anneeNaissance=nss; } // end Adherent /** ** Represents ... *
*/ public String getVille() { return ville; } // end getVille /** ** Represents ... *
*/ public void setVille(String _ville) { ville = _ville; } // end setVille } // end Adherent