100% Guaranteed Results


Java – Dice Solved
$ 24.99
Category:

Description

5/5 – (1 vote)

You want to test the probabilities for throwing a pair of dice. A regular die will give values between 1 and 6, inclusive, and a pair of dice will give values between 2 and 12. However their probabilities are not equally likely. You will have 6-­‐6 with probability 1/36,
whereas you will have a total of seven with probability 6/36 with outcomes 1-­‐6, 2-­‐5, 3-­‐4, 4-­‐3, 5-­‐2, and 6-­‐1.

Create an application which will first ask how many throws that you want to generate. Then, a 2D table that will hold the frequency of each outcome (such as 2-­‐5, 3-­‐4, 4-­‐3 etc.) should be created with all entries initialized to 0. Thereafter, random outcomes will be generated. You will generate two separate random numbers between 1 and 6 inclusive each to represent the outcome. Afterwards, you will increase the corresponding frequency in the 2D table by one. Having generated these outcomes, you will display the outcomes as a table. Finally, you will display the frequencies for the totals of the pairs and their rates.

[See sample runs below]

Reviews

There are no reviews yet.

Be the first to review “Java – Dice Solved”

Your email address will not be published. Required fields are marked *

Related products