I have a problem to calculate the average
let's admit, we need to know the average vote, so we add the votes of the surveys and we do the average.
So that if we have
Survey 1 : +1
Survey 2 : -1, -1, -1, +1
Survey 2 : +1
The average will be (+1 -1 -1 -1 +1 +1) / 6 = 0
So first thing to modify, have the average mark of all the surveys
Survey 1 : 1
Suveey 2 : -0,75
Survey 3 : 1
And then calculate the average of the surveys (1 - 0,75 +1) / 3 to have 0.41
I calculate the average of each survey as follows, take the case of the 2nd survey :
int survey2[] = {-1, -1, -1, 1};
int somme = 0;
for (int nombre : survey2) {
somme += nombre;
}
float moyenneSurvey2 = (float) somme /survey2.length;
System.out.println(moyenneSurvey2);
but I have a result of -0.5 instead of -0.75 which is wrong