package 专题练习;import java.util.Scanner;public class marking_by_judges {//需求:在唱歌比赛中,有6名评委给选手打分,范围是[0,100]的整数.//选手最后得分为去掉最高分和最低分的平均分public static void main(String[] args) {//储存分数数组int[] score_six = new int[6];for (int i = 0; i < 6; i++) {System.out.println("please input NO." + " " + (i+1) + " " + "number :");score_six[i] = score();if(score_six[i] == -1) {System.out.println("No. " + (i + 1) + " is wrong");return;}}avg_score(score_six);}//打分public static int score(){Scanner k = new Scanner(System.in);int num = k.nextInt();if(num > 100 || num < 0){return -1;}return num;}//算均分public static void avg_score(int[] data){int temp;//先从小到大排序 , 当然也可以直接找到最大值和最小值for (int i = 0; i < data.length ; i++) {for (int j = i+1; j < data.length ; j++) {if(data[i] > data[j]){temp = data[j];data[j] = data[i];data[i] = temp;}}}int sum = 0;for (int t = 1; t < data.length - 1; t++) {sum = sum + data[t];}System.out.println("The average number is " + sum * 1.0 / 4.0);} }