"Gewinn oder Nicht" Spiel hinzugefügt

This commit is contained in:
Felitendo
2025-05-06 14:36:09 +02:00
parent c3dc699066
commit 2f789bd6c5
3 changed files with 40 additions and 3 deletions

View 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;
}
}
}