Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1.  
  2. public class Monstre {
  3. private String nomMonstre;
  4. private int nbreDePv;
  5. private float poids;
  6.  
  7. public Monstre ( String newName, int newPv, float newPoids){
  8. this.nomMonstre = newName;
  9. this.nbreDePv = newPv;
  10. this.poids = newPoids;
  11. }
  12.  
  13. //******** Accesseurs *******
  14. public String getNomMonstre(){
  15. return this.nomMonstre;
  16. }
  17. public int getNbreDePv(){
  18. return this.nbreDePv;
  19. }
  20. public float getPoids(){
  21. return this.poids;
  22. }
  23.  
  24. //********* Mutateurs ********
  25. public void setNomMonstre(String nom){
  26. this.nomMonstre = nom;
  27. }
  28. public void setNbreDePv(int nbre){
  29. this.nbreDePv = nbre;
  30. }
  31. public float setPoids(float poids){
  32. return this.poids = poids;
  33. }
  34.  
  35. public String parler(){
  36. return "Je m'appelle " +this.nomMonstre+ ", j'ai " +this.nbreDePv+"pv et je pèses " +this.poids+ "Kg";
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement