package Debug;
import java.util.Scanner;
public class PweiDafen {
public static void main(String[] args) {
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();
}
int unm=getUnm(arr);
int min=getMin(arr);
int max=getMax(arr);
int vod=(unm-min-max)/4;
System.out.println("选手的最终评分是"+vod);
}
//int unm
public static int getUnm(int[]arr){
int unm=arr[0];
for(int x=1;x<arr.length;x++){
unm+=arr[x];
}
return unm;
}
//int min
public static int getMin(int[]arr){
int min=arr[0];
for(int x=1;x<arr.length;x++){
if(arr[x]<min){
min=arr[x];
}
}
return min;
}
//int max
public static int getMax(int[]arr){
int max=arr[0];
for(int x=1;x<arr.length;x++){
if(arr[x]>max){
max=arr[x];
}
}
return max;
}
public static void painArray(int[] arr) {
System.out.println("[");
for (int x = 0; x < arr.length; x++) {
if (x == arr.length - 1) {
System.out.println(arr[x]);
} else {
System.out.println(arr[x] + ",");
}
}
System.out.println("]");
}
}
|
|