File tree Expand file tree Collapse file tree 2 files changed +22
-22
lines changed
Expand file tree Collapse file tree 2 files changed +22
-22
lines changed Original file line number Diff line number Diff line change 22
33public class Dice {
44
5- private int id ;
6- private int value ;
5+ private int id ;
6+ private int value ;
77
8- public Dice (int id ) {
9- this .id = id ;
10- rollTheDice ();
11- }
8+ public Dice (int id ) {
9+ this .id = id ;
10+ rollTheDice ();
11+ }
1212
13- public int getId () {
14- return id ;
15- }
13+ public int getId () {
14+ return id ;
15+ }
1616
17- public int getValue () {
18- return value ;
19- }
17+ public int getValue () {
18+ return value ;
19+ }
2020
21- public void rollTheDice () {
22- Random random = new Random ();
23- value = random .nextInt (6 ) + 1 ;
24- }
21+ public void rollTheDice () {
22+ Random random = new Random ();
23+ value = random .nextInt (6 ) + 1 ;
24+ }
2525}
Original file line number Diff line number Diff line change 11public class Exercise {
22
33 public static void main (String [] args ) {
4- Dice dice = new Dice (1 );
4+ Dice dice = new Dice (1 );
55
6- System .out .println ("ID - Wuerfelwert" );
7- for (int i = 1 ; i <= 5 ; i ++) {
8- dice .rollTheDice ();
9- System .out .println (dice .getId () + " - " + dice .getValue ());
10- }
6+ System .out .println ("ID - Wuerfelwert" );
7+ for (int i = 1 ; i <= 5 ; i ++) {
8+ dice .rollTheDice ();
9+ System .out .println (dice .getId () + " - " + dice .getValue ());
10+ }
1111 }
1212}
You can’t perform that action at this time.
0 commit comments