1: |
|
2: | > //--
|
3: | > public class tut {
|
4: | > public static void main (String[] args){
|
5: | > int[][] punkte = new int [12] [];
|
6: | > //Teilnehmerliste einlesen
|
7: | > String[][] teilnehmer = teilnehmerEinlesen();
|
8: | >
|
9: | > //Punkte für alle Übungsblätter einlesen
|
10: | > for (int i = 0; i<punkte.length; i++){
|
11: | > punkte[i] = punkteEinlesen(teilnehmer, i );[/i]
|
12: | > [i] }[/i]
|
13: | > [i] [/i]
|
14: | > [i] //Teilnehmerliste ausgeben[/i]
|
15: | > [i] teilnehmerListe(teilnehmer, punkte);[/i]
|
16: | > [i] }[/i]
|
17: | > [i] public static String [][] teilnehmerEinlesen(){[/i]
|
18: | > [i] String[][] teilnehmer = new String [1][];[/i]
|
19: | > [i] for(int i = 0; i<12; i++){[/i]
|
20: | > [i] //Wenn Array voll dann vergroessern[/i]
|
21: | > [i] if (i== teilnehmer.length){[/i]
|
22: | > [i] teilnehmer = java.util.Arrays.copyOf(teilnehmer, [/i]
|
23: | > [i](i+1));[/i]
|
24: | > [i] }[/i]
|
25: | > [i] teilnehmer [i]= new String [2];[/i][/i]
|
26: | > [i][i] System.out.print("Teilnehmer " + (i+1) + ": ");[/i][/i]
|
27: | > [i][i] teilnehmer [i][0] = EingabeString();[/i][/i][/i]
|
28: | > [i][i][i] System.out.print("Studiengang von [mm]\""[/mm] + teilnehmer [i][0] + [/i][/i][/i][/i]
|
29: | > [i][i][i][i][mm]"\":[/mm] ");[/i][/i][/i][/i]
|
30: | > [i][i][i][i] teilnehmer[i][1] = EingabeString();[/i][/i][/i][/i][/i]
|
31: | > [i][i][i][i][i] [/i][/i][/i][/i][/i]
|
32: | > [i][i][i][i][i] String input;[/i][/i][/i][/i][/i]
|
33: | > [i][i][i][i][i] do {[/i][/i][/i][/i][/i]
|
34: | > [i][i][i][i][i] System.out.print("Weiteren Teilnehmer hinzufügen? [y/n] [/i][/i][/i][/i][/i]
|
35: | > [i][i][i][i][i]");[/i][/i][/i][/i][/i]
|
36: | > [i][i][i][i][i] input = EingabeString().toLowerCase();[/i][/i][/i][/i][/i]
|
37: | > [i][i][i][i][i] }while (!(input.equals("y") || input.equals("n")));[/i][/i][/i][/i][/i]
|
38: | > [i][i][i][i][i] [/i][/i][/i][/i][/i]
|
39: | > [i][i][i][i][i] if(input.equals("n")) {[/i][/i][/i][/i][/i]
|
40: | > [i][i][i][i][i] break;[/i][/i][/i][/i][/i]
|
41: | > [i][i][i][i][i] }[/i][/i][/i][/i][/i]
|
42: | > [i][i][i][i][i] }[/i][/i][/i][/i][/i]
|
43: | > [i][i][i][i][i] return teilnehmer;[/i][/i][/i][/i][/i]
|
44: | > [i][i][i][i][i] }[/i][/i][/i][/i][/i]
|
45: | > [i][i][i][i][i] public static int [] punkteEinlesen (String[][] [/i][/i][/i][/i][/i]
|
46: | > [i][i][i][i][i]teilnehmer, int blatt) {[/i][/i][/i][/i][/i]
|
47: | > [i][i][i][i][i] int[] punkte = new int [teilnehmer.length];[/i][/i][/i][/i][/i]
|
48: | > [i][i][i][i][i] for ( int i =0; i<teilnehmer.length; i++){[/i][/i][/i][/i][/i]
|
49: | > [i][i][i][i][i] // Gültige Punkte einlesen[/i][/i][/i][/i][/i]
|
50: | > [i][i][i][i][i] do{[/i][/i][/i][/i][/i]
|
51: | > [i][i][i][i][i] System.out.printf("Punkte für [mm]\"%s\"[/mm] für Blatt %2d: ", [/i][/i][/i][/i][/i]
|
52: | > [i][i][i][i][i]teilnehmer[i][0], (blatt+1));[/i][/i][/i][/i][/i][/i]
|
53: | > [i][i][i][i][i][i] punkte[i] = EingabeInt();[/i][/i][/i][/i][/i][/i][/i]
|
54: | > [i][i][i][i][i][i][i] }while (punkte[i]<0);[/i][/i][/i][/i][/i][/i][/i][/i]
|
55: | > [i][i][i][i][i][i][i][i] }[/i][/i][/i][/i][/i][/i][/i][/i]
|
56: | > [i][i][i][i][i][i][i][i] return punkte;[/i][/i][/i][/i][/i][/i][/i][/i]
|
57: | > [i][i][i][i][i][i][i][i] }[/i][/i][/i][/i][/i][/i][/i][/i]
|
58: | > [i][i][i][i][i][i][i][i] public static String EingabeString() {[/i][/i][/i][/i][/i][/i][/i][/i]
|
59: | > [i][i][i][i][i][i][i][i] java.util.Scanner sc = new java.util.Scanner(System.in);[/i][/i][/i][/i][/i][/i][/i][/i]
|
60: | > [i][i][i][i][i][i][i][i] return sc.nextLine();[/i][/i][/i][/i][/i][/i][/i][/i]
|
61: | > [i][i][i][i][i][i][i][i] }[/i][/i][/i][/i][/i][/i][/i][/i]
|
62: | > [i][i][i][i][i][i][i][i] public static int EingabeInt() {[/i][/i][/i][/i][/i][/i][/i][/i]
|
63: | > [i][i][i][i][i][i][i][i] try {[/i][/i][/i][/i][/i][/i][/i][/i]
|
64: | > [i][i][i][i][i][i][i][i] java.util.Scanner sc = new [/i][/i][/i][/i][/i][/i][/i][/i]
|
65: | > [i][i][i][i][i][i][i][i]java.util.Scanner(System.in);[/i][/i][/i][/i][/i][/i][/i][/i]
|
66: | > [i][i][i][i][i][i][i][i] return sc.nextInt();[/i][/i][/i][/i][/i][/i][/i][/i]
|
67: | > [i][i][i][i][i][i][i][i] } catch (Exception e) {}[/i][/i][/i][/i][/i][/i][/i][/i]
|
68: | > [i][i][i][i][i][i][i][i] return -1;[/i][/i][/i][/i][/i][/i][/i][/i]
|
69: | > [i][i][i][i][i][i][i][i] }[/i][/i][/i][/i][/i][/i][/i][/i]
|
70: | > [i][i][i][i][i][i][i][i] }[/i][/i][/i][/i][/i][/i][/i][/i]
|
71: | > [i][i][i][i][i][i][i][i] [/i][/i][/i][/i][/i][/i][/i][/i]
|
72: | > [i][i][i][i][i][i][i][i] |
[/i][/i][/i][/i][/i][/i][/i][/i]