评委打分

import java.util.Scanner;

public class dafen {
public static void main(String[] args) {
// 定义一个数组用动态初始化完成，长度为6
int[] arr=new int[6];
//键盘录入评委分数
Scanner sc =new Scanner(System.in);
for (int x = 0; x <arr.length ; x++) {
System.out.println(“请输入第”+(x+1)+“评委打分:”);
arr[x]=sc.nextInt();

    }

print(arr);
int max=getMax(arr);
int min=getMin(arr);
int sum=getSum(arr);
int avg=(sum-max-min)/arr.length-2;
System.out.println("选手的最终得分:"+avg);

}
//求和
public static int getSum(int []arr){
int sum=0;
for (int z = 0; z <arr.length ; z++) {
sum +=  arr[z];

}
return sum;

}

//求最小值
public static int getMin(int[]arr) {
int min = arr[0];
for (int x = 0; x < arr.length; x++) {
if (arr[x] < min) {
min = arr[x];

}

}

return min;
}


//求最大值
public static int getMax (int[]arr){
int max = arr[0];
for (int i = 0; i < arr.length; i++) {
if (arr[i] > max) {
max = arr[i];
}

        }
return max;

}

public static void print (int[] arr){
System.out.print("[");
for (int x = 0; x < arr.length ; x++) {
if(x==arr.length-1){
System.out.print(arr[x]);
}else {
System.out.print(arr[x]+",");
}

}
System.out.println("]");

}


}

12-21

07-30
11-09
07-19
04-26 3829
09-24 993
04-06 3937
04-27 865
12-05 1391