title: Happy, Hungry, Energy states
body: <p>I'm designing a simple tamagotchi with a Jpanel interface using Eclipse. Im trying to decide what would be best method to use when writing code for happy, hungry, energy states using loops, These are my two classes, I'm using abstract Animal class, and MyPet which extends an Animal class:</p>
  
  <p>Animal Class:</p>
  
  <pre><code>package GroupAnimal;
  
  import java.util.*;
  
  
  public abstract class Animal
  {
      protected int hungry;
      protected int happy;
      protected int energy;
      protected int toilet;
      protected int love;
      protected int health;
      protected int limbs;
      protected String name;
      protected String dob;
      protected double weight;
      protected double height;
  
  
      public int getHungry()
      {
          return hungry;
      }
  
      public int getHappy()
      {
          return happy;
      }
  
      public int getEnergy()
      {
          return energy;
      }
  
      public int gettoilet()
      {
          return toilet;
      }
  
      public int getLove()
      {
          return love;
      }
  
      public int getLimbs()
      {
          return limbs;
      }
  
      public int getHealth()
      {
          return health;
      }
  
      public String getName()
      {
          return name;
      }
  
      public String getDob()
      {
          return dob;
      }
  
      public double getWeight()
      {
          return weight;
      }
  
      public double getHeight()
      {
          return height;
      }
  
      protected void setName(String newName)
      {
          name = newName;
      }
  
      protected void setHeight(double newHeight)
      {
          height = newHeight;
      }
  
      protected void setWeight(double newWeight)
      {
          weight = newWeight;
      }
  
      protected void setLimbs (int newLimbs)
      {
          limbs = newLimbs;
      }
  
      protected void setDOB (String newDOB)
      {
          dob = newDOB;
      }
  
      protected abstract void die();
  
      protected abstract void feed(int amount);
  
      protected abstract void sleep (int amount);
  
      protected abstract void play (int amount);
  
      protected abstract void annoy (int amount);
  
      protected abstract void cuddles (int amount);
  
      protected abstract void sick (int amount);
  }
  </code></pre>
  
  <p>MyPet:</p>
  
  <pre><code>package IndividualPet; 
  
  import GroupAnimal.Animal;
  
  
  public class MyPet extends Animal
  {
  
  int Dec = 10;
  int Inc = 10;
  
  
  public MyPet(String aName, String aDOB,  int aRelease, int aLimbs, 
          double aWeight, double aHeight, int aEnergy, int aHungry) {
  energy = aEnergy;
  hungry = aHungry;
  name = aName;
  dob = aDOB;
  toilet = aRelease;
  limbs= aLimbs;
  weight= aWeight;
  height= aHeight;
  
  }
  
  
      // TODO Auto-generated constructor stub
  
  
  
  
  
  
  enum Skill { ROOKIE, ADVANCED, EXPERT}
  enum Concentration { LOW, MEDIUM, STRONG; }
  enum Hygiene { POOR, GOOD, EXCELLENT; }
  
  
  
  public void decHungry() {
  
  
      hungry -= Dec;
  
  }
  
  public void incEnergy() {
  
      energy += Inc;
  
  }
  
  
  @Override
  protected void die() {
      Runtime.getRuntime().halt(0);{
      System.out.println("Your pet has died");
      }
  }
  @Override
  protected void feed() {
  
       System.out.println("\nEating..."); 
  
  
  
         decHungry();
         incEnergy();
  
          if (hungry &lt; 0 &amp;&amp; energy &gt; 100) {
              hungry = 0;
              energy = 100;
              System.out.println("I have ate enough!");
          }
  
          System.out.println("I've just ate dumplings, my current energy state is " + energy 
                  +" and hungry state is " + hungry); 
          }
  
  
  
  @Override
  protected void sleep(int amount) {
      // TODO Auto-generated method stub
  
  }
  @Override
  protected void play(int amount) {
      // TODO Auto-generated method stub
  
  }
  @Override
  protected void annoy(int amount) {
      // TODO Auto-generated method stub
  
  }
  @Override
  protected void cuddles(int amount) {
      // TODO Auto-generated method stub
  
  }
  @Override
  protected void sick(int amount) {
      // TODO Auto-generated method stub
  
  }
  </code></pre>
  
  <p>}</p>
  
  <p>So this method allows me to decrease hungry state and increase energy state although when it gets out of bounds it keeps printing 
  **Eating...
  I've just ate dumplings, my current energy state is 100 and hungry state is 0</p>
  
  <p>Eating...
  I have ate enough!
  I've just ate dumplings, my current energy state is 100 and hungry state is 0</p>
  
  <p>Eating...
  I have ate enough!
  I've just ate dumplings, my current energy state is 100 and hungry state is 0** </p>
  
  <p><em>How do I remove every print statement except "I have ate enough!" when it is out of bounds?</em></p>
  
  <pre><code>@Override
  protected void feed() {
  
       System.out.println("\nEating..."); 
  
  
  
         decHungry();
         incEnergy();
  
          if (hungry &lt; 0 &amp;&amp; energy &gt; 100) {
              hungry = 0;
              energy = 100;
              System.out.println("I have ate enough!");
          }
  
          System.out.println("I've just ate dumplings, my current energy state is " + energy 
                  +" and hungry state is " + hungry); 
          }
  </code></pre>
  
  <p>Anyone can throw any specific examples on how to do that? </p>