title: How to set a default increment/decrement value in Java
body: <p>OK so I have an issue with a homework problem. I'm building a class that be used in a tester class provided by my instructor. Its nothing more than a basic counter. I've got the counter set up to where numbers passed by the tester to my class work fine and output is as expected. However my class must have the initial count set to 0 and a default increment/decrement of 1.</p>
  
  <p>Here is my class:</p>
  
  <pre><code>public class Counter
  {
      private int count;
      private int stepValue;
  
      /**
       * This method transfers the values called from CounterTester to instance variables
       * and increases/decreases by the values passed to it. It also returns the value
       * of count. 
       *
       * @param args
       */ 
      public Counter (int initCount, int value)
      {       
          count=initCount;
          stepValue=value;
      }   
  
      public void increase ()
      {
          count = count + stepValue;
      }
  
      public void decrease ()
      {
          count = count - stepValue;
      }
  
      public int getCount()
      {
          return count;
      }
  
  }
  </code></pre>
  
  <p>Here is the tester class:</p>
  
  <pre><code>public class CounterTester
  {
  
      /**
       * This program is used to test the Counter class and does not expect any
       * command line arguments. 
       *
       * @param args
       */
      public static void main(String[] args)
      {
          Counter counter = new Counter();
  
          counter.increase();
          System.out.println("Expected Count: 1 -----&gt; Actual Count: " + counter.getCount());
  
          counter.increase();
          System.out.println("Expected Count: 2 -----&gt; Actual Count: " + counter.getCount());
  
          counter.decrease();
          System.out.println("Expected Count: 1 -----&gt; Actual Count: " + counter.getCount());
  
  
          counter = new Counter(3, 10);
          System.out.println("Expected Count: 3 -----&gt; Actual Count: " + counter.getCount());
  
          counter.increase();
          System.out.println("Expected Count: 13 ----&gt; Actual Count: " + counter.getCount());
  
          counter.decrease();
          System.out.println("Expected Count: 3 -----&gt; Actual Count: " + counter.getCount());
  
          counter.decrease();
          System.out.println("Expected Count: -7 ----&gt; Actual Count: " + counter.getCount());
      }
  
  }
  </code></pre>