diff --git "a/\346\225\260\347\273\204\347\273\203\344\271\240/\351\231\210\350\257\227\346\235\260/Day1.java" "b/\346\225\260\347\273\204\347\273\203\344\271\240/\351\231\210\350\257\227\346\235\260/Day1.java" new file mode 100644 index 0000000000000000000000000000000000000000..f58ccf8eee0117d5cf43fcf40e72a279ec52fc21 --- /dev/null +++ "b/\346\225\260\347\273\204\347\273\203\344\271\240/\351\231\210\350\257\227\346\235\260/Day1.java" @@ -0,0 +1,44 @@ +package com.Whos.daddy; + +import java.util.Arrays; +import java.util.Scanner; + +public class Day1 { + + public static void main(String[] args) { + int[] score = new int[6]; + Scanner scanner = new Scanner(System.in); + + for (int i = 0; i < score.length; i++) { + System.out.println("第"+(i + 1)+ "个评委打分:"); + int scroing = scanner.nextInt(); + + if (scroing > 100 || scroing < 0) { + System.err.println("您输入的成绩有误,请重新输入!"); + i--; + }else { + score[i] = scroing; + } + } + + Arrays.sort(score); + +/* 最大值,最小值同理 + * int MAX = score[0] + * for(int i = 1 ; i < score.length ; i++){ + * if(MAX< score[i]){ + * MAX = score[i] + * } + * } + */ + + int sum = 0; + for (int i = 1; i < score.length - 1; i++) { + sum += score[i]; + } + + System.out.println("去掉的一个最高分为:" + score[score.length - 1]); + System.out.println("去掉的一个最低分为:" + score[0]); + System.out.println("这个选手的平均分为:" + (sum/(score.length-2))); + } +}