File tree Expand file tree Collapse file tree 2 files changed +37
-1
lines changed
Expand file tree Collapse file tree 2 files changed +37
-1
lines changed Original file line number Diff line number Diff line change 1+ import java .util .ArrayList ;
2+
3+ public class DiceCup {
4+
5+ public void rollTheDices (ArrayList <Dice > dices ) {
6+ for (int i = 0 ; i < dices .size (); i ++) {
7+ Dice dice = dices .get (i );
8+ dice .rollTheDice ();
9+ System .out .println (dice .getId () + " - " + dice .getValue ());
10+ }
11+ }
12+
13+ public void rollTheDices (Dice [] dices ) {
14+ for (int i = 0 ; i < dices .length ; i ++) {
15+ Dice dice = dices [i ];
16+ dice .rollTheDice ();
17+ System .out .println (dice .getId () + " - " + dice .getValue ());
18+ }
19+ }
20+
21+ }
Original file line number Diff line number Diff line change 1+ import java .util .ArrayList ;
2+
13public class Exercise {
24
35 public static void main (String [] args ) {
4- // implement exercise here
6+ ArrayList <Dice > dices = new ArrayList <>();
7+
8+ for (int i = 1 ; i <= 5 ; i ++) {
9+ Dice dice = new Dice (i );
10+ dices .add (dice );
11+ }
12+
13+ DiceCup diceCup = new DiceCup ();
14+
15+ System .out .println ("ID - Wuerfelwert" );
16+ for (int i = 1 ; i <= 5 ; i ++) {
17+ System .out .println ("Wurf " + i );
18+ diceCup .rollTheDices (dices );
19+ }
520 }
621}
You can’t perform that action at this time.
0 commit comments