RunningAverage extends RunningTotal { public RunningAverage(int size, int precision) { super(size); this.precision = precision; } RunningAverage(int size, int precision); @Override String toString(); String toString(int temporaryPrecision);  }
@Test public void runningAverage() { RunningAverage avg = new RunningAverage(3, 1); Assert.assertEquals("0.0", avg.toString()); avg.add(2); Assert.assertEquals("2.0", avg.toString()); avg.add(3); Assert.assertEquals("2.5", avg.toString()); avg.add(4); Assert.assertEquals("3.0", avg.toString()); avg.add(5); Assert.assertEquals("4.0", avg.toString()); Assert.assertEquals("4.000", avg.toString(3)); Assert.assertEquals("4", avg.toString(0)); }