"Gewinn oder Nicht" Spiel hinzugefügt
This commit is contained in:
21
src/de/javagames/Spiele.java
Normal file
21
src/de/javagames/Spiele.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package de.javagames;
|
||||
|
||||
public class Spiele {
|
||||
public static void gewinnOderNiete() {
|
||||
int zahl = (int) (Math.random() * 6) + 1;
|
||||
|
||||
int i = 0;
|
||||
while (i < 10) {
|
||||
switch (zahl) {
|
||||
case 1, 2, 3, 4, 5:
|
||||
System.out.println("Niete");
|
||||
break;
|
||||
case 6:
|
||||
System.out.println("Gewinn");
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
zahl = (int) (Math.random() * 6) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user