commit 00c56087a62b54b40b7a9b4e775edab1c2d18924 Author: Marco Angelo Palmieri <3006451@stud.hs-mannheim.de> Date: Sun May 5 19:29:41 2024 +0200 Basisstruktur Würfel diff --git a/Würfel.java b/Würfel.java new file mode 100644 index 0000000..c7285d0 --- /dev/null +++ b/Würfel.java @@ -0,0 +1,18 @@ +import java.util.Random; + +/** + * Diese Klasse repräsentiert einen einzelnen Würfel. + */ +public class Würfel { + private int augenzahl; + private final int MAX_AUGEN = 6; + private static final Random random = new Random(); + + /** + * Würfelt den Würfel und erzeugt eine neue Augenzahl zwischen 1 und MAX_AUGEN. + */ + public void würfeln() { + augenzahl = random.nextInt(MAX_AUGEN) + 1; + } +} +