I'm working on this program for my intro to java class. I've been having a lot of issues. I'm using eclipse. The program is supposed to find the average, range, min, and max numbers. I have everything (at least I do according to her notes, which confuse me...) and have put it all into eclipse. It keeps telling me an error that I need a while(); to end the loop. I've already done this...have I put in the wrong place? What am I doing wrong??
import java.util.Scanner;
public class A_Alnor_SquenceOfNumbers {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int count = 0;
double sum = 0;
double input = 0;
double average;
double min = in.nextDouble();
double max = in.nextDouble();
do {
System.out.println("Enter a value, type -1 to finish: ");
boolean done = false;
while (!done) {
input = in.nextDouble();
if (input == -1) {
done = true;
} else
while (in.hasNextDouble()) {
input = in.nextDouble();
sum = sum + input;
count++;
}
if (count > 0) {
average = sum / count;
}
while (in.hasNextDouble()) {
input = in.nextDouble();
if (input > max) {
max = input;
}
while (in.hasNextDouble())
if (input < min) {
min = input;
}
}
}
while (done) ;
{
System.out.println("The average is " + average + ".");
System.out.println("The smallest number is " + min + ".");
System.out.println("The largest number is " + max + ".");
System.out.println("the range is " + min + " to " + max + ".");
System.out.println(count);
}
}
}
}