APL/APL2.1/TP08/Moyenne/Moyenne.java

18 lines
301 B
Java
Raw Normal View History

2022-03-14 17:26:22 +01:00
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;
}
}