Gives wrong answer only and I can't find the reason why? This is only part of the code but the rest was copy pasted so it does the same thing. I have tried to tweak it and find a solution online but everything seems to be in order. Maybe the counter is incorrect and can't deal with the negative numbers? The answer is always 107.19999999.
public class draft3 {
public static void main (String []args) {
/* Create arrays for each company*/
int NL5755[] = new int[] {60, 70, -10, -12, 10};
//Assign a value of 0 to total
double sum = 0;
double average1=0;
{
/*Use a counter. For i smaller than the*/
/*value of the length of the array, add them to sum*/
for(int i=0; i<NL5755.length; i++)
{
sum = sum + NL5755[i];
average1 += sum / NL5755.length;
}