package javabasic;

import java.util.Arrays;
import java.util.Scanner;

public class demo05 {
public static void main(String[] args) {
int[] arr = new int[7];
int grade ;
Scanner sc = new Scanner(System.in);
for(int i = 0 ; i < arr.length ; i ++)
{
System.out.print("请第"+(i + 1)+"个评委打分(0 - 100): ");
arr[i] = sc.nextInt();
}
System.out.println("得分汇总为:");
print_Arr(arr);
grade = new_Arr(arr);
System.out.println("去掉一个最高分,去掉一个最低分");
System.out.println("最终的得分为"+grade);
}
public static void print_Arr(int[] ar)
{
System.out.print("[");
for(int i : ar)
{
System.out.print(i+" ");
}
System.out.println("]");
}
public static int new_Arr(int[] ar){
Arrays.sort(ar);
int sum = 0;
for(int i = 1; i < ar.length - 1 ; i ++)
{
sum += ar[i];
}
return sum / (ar.length -2);
}
}