public class Geniegotchi {
private String name = "Bob";
private int endurance = 4;
private int happiness = 3;
public void setName(String newName){
name = newName;
}
public void setEndurance(int newEndurance){
endurance = newEndurance;
}
public void setHappiness (int newHappiness){
happiness = newHappiness;
}
public String getName(){
return name;
}
public int getEndurance (){
return endurance;
}
public int getHappiness (){
return happiness;
}
public void genieInfo(){
System.out.println( "current name: "+this.getName());
System.out.println( "current happiness level: "+this.getHappiness());
System.out.println( "current endurance level: "+this.getEndurance());
}
public void feed(){
if (this.getEndurance() <= 10){
}
else
System.out.println("No, thanks...");
}
public void play(){
if (this.getHappiness() < 10){
}
else
System.out.println("No, thanks");
}
void feed() method to increases current endurance by 1 if endurance is less than 10, otherwise it prints a “No, thanks...” message to the screen;
void play() method is to increases current happiness by 1 and decreases current endurance by 2, if happiness is less than 10, then this otherwise it prints a “No, thanks...” message to the screen;
For the void feed and void play parts, I don't know how to increases current endurance by 1, and increases current happiness by 1 and decreases current endurance by 2. Thank you