Working with the MultiDice Class

 

First design the MultiDice Class as discussed in class. Then use MultiDiceTest.java to check whether your class is working properly. This file can be found in the same folder as this and should be copied into your workspace folder. After that is successful, please do the following:

 

 

1.   In the game of Yahtzee, the ultimate goal is to roll 5 dice and have them all come up the same. In the real game, you get three tries, but in this simulation, we will estimate the chances of rolling once and having all 5 dice come up the same number. To do so, roll 5 dice 100,000 times and keep track of how many times all 5 dice come up the same. Display the final result as a count and a percent.

 

Example

If the 5 rolls are  5, 4, 5, 5 and 1 you DO NOT have a Yahtzee

If the 5 rolls are  3, 3, 3, 3 and 3 you DO have a Yahtzee

 

Final results should be displayed as follows:

You got a Yahtzee 15 times(.015%)

 

 

2.   Write a program that will allow you to roll an 8-sided die 1000 times and keep track of the results. Display them as follows.

 

 

                        Number          Count          % Occurrence        

 

         1 125/1000     12.5 %

         2 125/1000     12.5 %

         3 125/1000     12.5 %

         4 125/1000     12.5 %

         5 125/1000     12.5 %

         6 125/1000     12.5 %

         7 125/1000     12.5 %

         8 125/1000     12.5 %

 

 

 

3.   Write a program that will allow you to roll two 4-sided dice 1000 times and keep track of the results. Display them as follows.

 

 

                        Number          Count          % Occurrence        

 

         2 100/1000     10.0 %

         3 100/1000     10.0 %

         4 200/1000     20.0 %

         5 200/1000     20.0 %

         6 200/1000     20.0 %

         7 100/1000     10.0 %

         8 100/1000     10.0 %