Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Monstre {
- private String nomMonstre;
- private int nbreDePv;
- private float poids;
- public Monstre ( String newName, int newPv, float newPoids){
- this.nomMonstre = newName;
- this.nbreDePv = newPv;
- this.poids = newPoids;
- }
- //******** Accesseurs *******
- public String getNomMonstre(){
- return this.nomMonstre;
- }
- public int getNbreDePv(){
- return this.nbreDePv;
- }
- public float getPoids(){
- return this.poids;
- }
- //********* Mutateurs ********
- public void setNomMonstre(String nom){
- this.nomMonstre = nom;
- }
- public void setNbreDePv(int nbre){
- this.nbreDePv = nbre;
- }
- public float setPoids(float poids){
- return this.poids = poids;
- }
- public String parler(){
- return "Je m'appelle " +this.nomMonstre+ ", j'ai " +this.nbreDePv+"pv et je pèses " +this.poids+ "Kg";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement