Grosse MàJ
This commit is contained in:
BIN
workspace/Adherent/PackAdh/Adherent.class
Normal file
BIN
workspace/Adherent/PackAdh/Adherent.class
Normal file
Binary file not shown.
132
workspace/Adherent/PackAdh/Adherent.java
Normal file
132
workspace/Adherent/PackAdh/Adherent.java
Normal file
@ -0,0 +1,132 @@
|
||||
package PackAdh;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Cette classe permet de g<>rer des Adh<64>rent.
|
||||
*/
|
||||
public class Adherent {
|
||||
|
||||
private int numeroAdherent;
|
||||
private String nom;
|
||||
private String ville;
|
||||
private int anneeNaissance;
|
||||
static int c_montantCotisation = 45;
|
||||
private int cotisationVersee;
|
||||
|
||||
/**
|
||||
* Donne le nom de l'adh<64>rent courant.
|
||||
*/
|
||||
public String getNom()
|
||||
{
|
||||
return this.nom;
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne le num<75>ro de l'adh<64>rent courant.
|
||||
*/
|
||||
public int numeroAdherent()
|
||||
{
|
||||
return this.numeroAdherent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne l'<27>ge de l'adh<64>rent courant.
|
||||
*/
|
||||
public int getAge()
|
||||
{
|
||||
int annee;
|
||||
DateFormat format = new SimpleDateFormat("yyyy");
|
||||
annee = Integer.parseInt(format.format(new Date()));
|
||||
return annee - this.anneeNaissance;
|
||||
}
|
||||
|
||||
/**
|
||||
* Donne la cotisation qu'a vers<72> l'adh<64>rent courant."
|
||||
*/
|
||||
public int getCotisationVersee()
|
||||
{
|
||||
return this.cotisationVersee;
|
||||
}
|
||||
|
||||
/**
|
||||
* Informe par un bool<6F>an, du versement ou non du total de la cotisation par l'adh<64>rent courant.
|
||||
*/
|
||||
public boolean aJour()
|
||||
{
|
||||
boolean resultat;
|
||||
resultat = false;
|
||||
if (cotisationVersee == c_montantCotisation)
|
||||
{
|
||||
resultat = true;
|
||||
}
|
||||
return resultat;
|
||||
}
|
||||
|
||||
/**
|
||||
* Permet l'ajout d'une cotisation d'une valeur sp<73>cifique, vers<72>e par l'adh<64>rent courant.
|
||||
*/
|
||||
public boolean cotiser(int versement)
|
||||
{
|
||||
cotisationVersee += versement;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructeur de la classe Adh<64>rent.
|
||||
*/
|
||||
public Adherent(int numAdh, String nomAdh, String villeAdh, int anneeNaissAdh)
|
||||
{
|
||||
numeroAdherent = numAdh;
|
||||
nom = nomAdh;
|
||||
ville = villeAdh;
|
||||
anneeNaissance = anneeNaissAdh;
|
||||
cotisationVersee = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne l'<27>tat de l'adh<64>rent courant au niveau de son versement (s'il est <20> jour ou pas).
|
||||
*/
|
||||
public String etat()
|
||||
{
|
||||
String resultat = "pas <20> jour";
|
||||
|
||||
if(aJour() == true)
|
||||
{
|
||||
resultat = "a jour";
|
||||
}
|
||||
|
||||
return resultat;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Retourne l'ensemble des attributs de l'adh<64>rent courant.
|
||||
*/
|
||||
public String toString()
|
||||
{
|
||||
String resultat;
|
||||
|
||||
resultat = "NumeroAdh<EFBFBD>rant : " + this.numeroAdherent;
|
||||
resultat = resultat + "\nNom : " + this.nom;
|
||||
resultat = resultat + "\nVille : " + this.ville;
|
||||
resultat = resultat + "\nAnn<EFBFBD>e de naissance : " + this.anneeNaissance;
|
||||
resultat = resultat + "\nCotisation : " + this.cotisationVersee;
|
||||
resultat = resultat + "\nEtat : " + this.etat();
|
||||
|
||||
return resultat;
|
||||
}
|
||||
|
||||
/**
|
||||
* M<>thode principale.
|
||||
*/
|
||||
public static void main(String[] args)
|
||||
{
|
||||
/*Adherent adh1 = new Adherent(1,"DUPONT","STRASBOURG",1985);
|
||||
System.out.println(adh1.toString());
|
||||
adh1.cotiser(45);
|
||||
System.out.println(adh1.toString());*/
|
||||
}
|
||||
}
|
BIN
workspace/Adherent/PackAdh/Gerant.class
Normal file
BIN
workspace/Adherent/PackAdh/Gerant.class
Normal file
Binary file not shown.
22
workspace/Adherent/PackAdh/Gerant.java
Normal file
22
workspace/Adherent/PackAdh/Gerant.java
Normal file
@ -0,0 +1,22 @@
|
||||
package PackAdh;
|
||||
|
||||
public class Gerant {
|
||||
|
||||
/**
|
||||
* @param args
|
||||
*/
|
||||
public static void main(String[] args) {
|
||||
// TODO Auto-generated method stub
|
||||
Adherent adh1 = new Adherent(1,"DUPONT","Paris",1980);
|
||||
Adherent adh2 = new Adherent(2,"MEYER","Strasbourg",1955);
|
||||
Adherent adh3 = new Adherent(3,"LEGWENN","Brest",1960);
|
||||
|
||||
adh1.cotiser(45);
|
||||
adh2.cotiser(30);
|
||||
System.out.println(adh2.toString());
|
||||
adh3.cotiser(40);
|
||||
adh2.cotiser(15);
|
||||
System.out.println(adh2.toString());
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user