import java.util.Scanner;
public class SumArray {
public static void main(String[] args) {
int average = 0;
int sum = 0;
Scanner keyboard = new Scanner(System.in);
System.out.println("Enter as many numbers as you wish. Enter -99 to finish your input.");
do {
int i = 0;
int numArray[];
numArray [i] = keyboard.nextInt();
sum = sum + numArray[i];
i++;
**} while (numArray[i] != -99);**
**average = sum/numArray.length;**
System.out.println("The sum of the numbers is " + sum + ".");
System.out.println("The average of the numbers is " + average + ".");
}
}
I am getting an error on the two lines I asterisked. It says that numArray cannot be resolved to a variable, as well as i. I am using eclipse as my IDE.
scope.numArrayvariable outside the 'do' loop. Andi.