public class Moyenne { private int count; private double sum; public Moyenne() { count = 0; sum = 0; } public void add(Number n) { count++; sum += n.doubleValue(); } public double getAverage() { return sum / (double)count; } }