⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dive.java

📁 Java经典例程 从外国一大学计算机教授出版物下载的代码 经典
💻 JAVA
字号:
import java.io.*;

class Dive {

    /* The Dive Class    by J M Bishop Dec 1996
     *                    Java 1.1 October 1997
     * Stores and assesses diving scores for one dive.
     *
     * Illustrates arrays
     */

    int minJudge, maxJudge, minScore, maxScore, sum;

    private int noOfJudges;
    private int score [];

    Dive (int n) {
      noOfJudges = n;
      score = new int [noOfJudges];
    }

    void setScore (int i, int s) {
      score [i] = s;
    }

    void assessScores() {
        minScore = 10;
        maxScore = 0;
        sum = 0;
        for (int i = 0; i < noOfJudges; i++) {
            sum += score[i];
            if (score[i] <= minScore) {
                minScore = score[i];
                minJudge = i;
            }
            if (score[i] > maxScore) {
                maxScore = score[i];
                maxJudge = i;
            }
        }
        minJudge++;
        maxJudge++;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -