package counter;

public class Counter {
   private int count;  // attribute - keeps the internal count

  public Counter() {   // constructor - initializes internal count to 0
     count = 0;
  }

  public Counter(int n) { // constructor - initializes internal count to n
    count = n;
  }

  public void decrement() { // subtract one from internal count
    count--;
  }

  public void decrement(int n) { // subtract n from internal count
    count = count - n;
  }

  public int getCount() { // get the internal count value
     return count;
  }

  public void increment() { // add one to the internal count
    count++;
  }

  public void increment(int n) { // add n to the internal count
    count = count + n;
  }

  public void setCount( ) { // set the internal count to 0
    count = 0;
  }

  public void setCount(int value) { // set the internal count to value
     count = value;
  }

  public String toString() { // return a String with object's info
    return "count=" + count;
  }
}

