Question: This is for Math 130- Java coding and its on objects, methods and random class. We have covered if, else, if-else, and for loops :).
This is for Math 130- Java coding and its on objects, methods and random class. We have covered if, else, if-else, and for loops :). We have not covered arrays or all the crazy stuff that is to come. I would very much appreciate comments in the code to see if what I am doing is correct and to fully understand the assignment. Thanks a lot. :)

aying with dice. art 1) Define a new class named Die (from dice, not death). Remember that the Dice class will not have a main) method, so you should have to define a project with a class containing the main) method. Lets call the project DieDemo, which will have the class DieDemo with the ain) method and the Die class who we are studhying our Die class should have at least one field, type integer, which will be a random number between zero and six. our class should have at least one method to "toss" the die in such way that it simulates the tossing of a real fair die. As we know, the probability of amy number between 1 and 6 is the same: 1/6 When you call the toss) methad from your main) method, it will return one random number between 1 and 6. To test the fainess of your dice,toss your dice about 1000000 times and calculate the probability of each number by counting the occurrence of each one of the six counting umbers and dividing it by 1000000. You may find useful to define this number using inal int TRIALS 1000000: each time we want to run with different values, only the constant is changed. A sample run is shown below unber 1 probebility 0.166652 Nunber 2 probsbility 0.167090 Nunber 6 probability 0.166429 f the theoretical probability of each number is reasonably close to 1/6, then we can conclude that the die is fair. art 2) Now that you have a die, create more dice to approach numerically the following probabilities. Keep the number of TRIALS at 1000000 or more 1 The probability of landing a sum-7 using 2 dice. For example, 1 and 6, or 4 and 3, or any other combination that sums 7 from both dice. 2 The probability of landing a number greater than 12 using three dice 3 The probability of landing the number 5 in all three dice 4. The probability of landing a sum-15 using three dice. art 3) Explain what modifications can be done to the Die class to create a "loaded" or unfair DiceYou don't have to code il st explain your idea. UBMIT YOUR CODE INDENTED AND COMMENTED nclude both your Die class and the driver class PROPERLY
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
