JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.ArrayList;
public class DiceRoller
{
public static void main(String[] args)
{
Dice dice = new Dice();
int MAX_ROLL_COUNT = 100; // Number of rolls
ArrayList<Integer> results = new ArrayList<>(MAX_ROLL_COUNT);
for(int i = 0; i < MAX_ROLL_COUNT; i++)
{
dice.roll();
results.add(dice.getDice());
}
// show the result
showResult(results);
}
static void showResult(ArrayList<Integer> res)
{
int ONE=0, TWO=0, THREE=0, FOUR=0, FIVE=0, SIX=0;
for (int result : res)
{
switch (result)
Enter to Rename, Shift+Enter to Preview
OUTPUT
Ejecutar