public class Noten {

    double[] noten = { 1.0, 1.3, 4.0, 3.7, 2.3, 2.7, 1.7, 3.3, 3.0, 5.0, 4.0, 3.0, 1.0, 3.7, 3.3, 2.7, 5.0, 4.0, 1.7,
            1.3, 4.0, 3.7, 2.3, 3.7, 1.7, 3.3, 3.7, 4.0, 4.0, 3.0, 1.0, 3.7, 3.3, 2.7, 5.0, 4.0 };

    // Bestimme Mittelwert, Minimum, Maximum  der Noten
    private void test1() {
        // maximum
        double maxNote = getMaximumNote(noten);
        System.out.println("maxNote: "+maxNote);
        double minNote = getMinimumNote(noten);
        System.out.println("maxNote: "+minNote);
        double mittelwertNote = getMittelwertNote(noten);
    }

    private double getMittelwertNote(double[] noten) {
        double summe=0.0;
        for (double note : noten) {
            summe+=note;
        }
        double mittelwert = summe / noten.length;
        return mittelwert;
    }
    private double getMaximumNote(double[] noten) {
        double maxNote=noten[0];
        for (double note : noten) {
            if (note>maxNote) {
                maxNote = note;
            }
        }
        return maxNote;
    }

    private double getMinimumNote(double[] noten) {
        double minNote=noten[0];
        for (double note : noten) {
            if (note<minNote) {
                minNote = note;
            }
        }
        return minNote;
    }

    // bestimme die zweitniedrigste Note
    private void test2() {
        double[] zahlen = {3,1,5,11,4,3,2,40};
        double min2 = getMinimum2Note(zahlen);
        System.out.println("Zweitniedrigste Note: "+min2);
    }

    private double getMinimum2Note(double[] noten) {
        double minNote1=noten[0];
        double minNote2=noten[0];
        for (double note : noten) {
            if (note<minNote1) { // es gibt eine neue kleinste Note
                minNote2 = minNote1;
                minNote1 = note;
            }
            else if (note<minNote2) { // es gibt eine neue kleinste Note
                minNote2 = note;
            }
        }
        return minNote2;
    }

    public static void main(String[] args) {
        System.out.println("in main");
        Noten instance = new Noten();
        instance.test1();
    }
}