Question: A - Dice are used in many games. One die can be thrown to randomly show a value from 1 to 6 . Design a
A Dice are used in many games. One die can be thrown to randomly show a value from to
Design a Die class that can hold an integer data field for a value from to Include a
constructor that randomly assigns a value to a die object. The following statement can be used to
generate a random number between and and assign it to a variable. Using this statement
assumes you have assigned appropriate values to the static constants:
value intMathrandom HIGHESTDIEVALUE LOWESTDIEVALUE;
Also include a method in the class to return a dies value.
Write an application that randomly throws two dice and displays their values.
B Using the Die class, write an application that randomly throws five dice for the computer
and five dice for the player. Display the values and then, by observing the results, decide who
wins based on the following hierarchy of Die values. The computer will not decide the winner;
the player will determine the winner based on observation. Any higher combination beats a
lower one; for example, five of a kind beats four of a kind.
five of a kind
four of a kind
three of a kind
a pair
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
