虽然不太懂你的IO。。不过如果假设那些IO什么的都对的话,其他的地方可以这样改一下
(当然Scanner部分你可以自行替换成你的IO部分):
import java.util.Scanner;
public class Scores {
public static void main(String[] args) throws Exception {
System.out.println("Enter the number of judges on the panel.");
Scanner s = new Scanner(System.in);
int n = s.nextInt();
double min = 10, max = 0, sum = 0;
for (int i = 0; i < n; i++){
System.out.println("Enter the score:");
double temp = s.nextDouble();
while (temp < 0 || temp > 10) {
System.out.println("Invalid score, please re-enter the score:");
temp = s.nextDouble();
}
sum += temp;
min = Math.min(min, temp);
max = Math.max(max, temp);
}
double finalScore = (sum-min-max) / (double)(n-2);
System.out.println(finalScore);
}
}