Basisstruktur Würfel
commit
c4c534be00
|
@ -0,0 +1,18 @@
|
|||
package domain;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Diese Klasse repräsentiert einen einzelnen Würfel.
|
||||
*/
|
||||
public class Würfel {
|
||||
private int augenzahl;
|
||||
private static final Random random = new Random();
|
||||
|
||||
/**
|
||||
* Würfelt den Würfel und erzeugt eine neue Augenzahl zwischen 1 und 6.
|
||||
*/
|
||||
public void würfeln() {
|
||||
augenzahl = random.nextInt(6) + 1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue