halfdollars.java

来自「21天JAVA学习! 21天JAVA学习! 21天JAVA学习!」· Java 代码 · 共 23 行

JAVA
23
字号
class HalfDollars {
    public static void main(String[] arguments) {
        int[] denver = { 15000006, 18810000, 20752110 };
        int[] philadelphia = new int[denver.length];
        int[] total = new int[denver.length];
        int average;

        philadelphia[0] = 15020000;
        philadelphia[1] = 18708000;
        philadelphia[2] = 21348000;

        total[0] = denver[0] + philadelphia[0];
        total[1] = denver[1] + philadelphia[1];
        total[2] = denver[2] + philadelphia[2];
        average = (total[0] + total[1] + total[2]) / 3;

        System.out.println("1993 production: " + total[0]);
        System.out.println("1994 production: " + total[1]);
        System.out.println("1995 production: " + total[2]);
        System.out.println("Average production: "+ average);
    }
}

⌨️ 快捷键说明

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