This is an example straight out of my text book, and I can't get it to end the loop.
import java.util.Scanner;
public class Play {
System.out.println("Enter scores for all students.");
System.out.println("Enter a negative number after");
System.out.println("you have entered all the scores.");
Scanner keyboard = new Scanner(System.in);
double max = keyboard.nextDouble();
double min = max;
double next = keyboard.nextDouble();
while(next >= 0)
{
if(next > max)
max = next;
else if (next < min)
min = next;
next = keyboard.nextDouble();
}
System.out.println("The highest score is " + max);
System.out.println("The lowest score is " + min);
}