package yi.ds.sum;

/**
 * IntSummationStruct implements a summation of integers.  The struct will keep
 * the counter and the total of the data to be sum.
 */

public class IntSummationStruct {
  public int counter;
  public int total;

  public IntSummationStruct() {
  }

  public IntSummationStruct(int[] data) {
    counter = data.length;
    for (int i=0; i<data.length; i++) {
      total += data[i];
    }
  }

  public void putToSum(int data) {
    counter++;
    total += data;
  }
}