- a static boolean method threeSame which takes an array of Dies and returns a
count of how many all three of the Dies passed to it have the same val
- a static boolean method twoSame(die1,die2,die3) returns true if any two (but not 3) of the Dies passed to it have the same val
Then add a static method nDice(int sval, int numDice). In this method:
- set the number of faces for Die to sval
- create numDice Dies
- in a loop 1000 times: roll all the Dies, print them out on a line side by
side, and use twosame and threesame to determine if we have matches
- at the end, return an array of size 2 holding how often they came up two (but not three) the same, and how often three the same.
2: Add a class TryDice with a main.
In the main, call threeDice for numbers for from 3 to 5 Dies with
from 3 to 12 faces, and store the results in 2 2D arrays (one for
two the same and one for three the same ) (or EC+5, in a single 3D
array). Print them in two nicely labeled tables.