Question

In: Computer Science

/** * findHighestDie * This method will determine the highest value on the * three dice...

/**
 * findHighestDie
 * This method will determine the highest value on the
 * three dice
 * @return the highest value
 */

Write the method that matches this comment.

Solutions

Expert Solution

class GFG

{

// Function find the maximum expectation

static double expect(double m, double n)

{

    double ans = 0.0, i;

    for (i = m; i > 0; i--)

     

        // formula to find the maximum number

        // and sum of maximum numbers

        ans += (Math.pow(i / m, n) -

                Math.pow((i - 1) / m, n)) * i;

    return ans;

}

// Driver code

public static void main(String[] args)

{

    double m = 6, n = 3;

    System.out.println(String.format("%.5f",

                             expect(m, n)));

}

}


Related Solutions

1. Three six-sided dice are rolled. Let X be the sum of the dice. Determine the...
1. Three six-sided dice are rolled. Let X be the sum of the dice. Determine the range of X and compute P(X = 18) and P(X ≤ 4). 2. An urn contains 5 red balls and 3 green balls. (a) Draw 3 balls with replacement. Let X be the number of red balls drawn. Determine the range of X and compute P(X = 3) and P(X 6= 1). (b) Draw 3 balls without replacement. Let Y be the number of...
Determine the entropy of the random variable which counts the sum of three dice.
Determine the entropy of the random variable which counts the sum of three dice.
A pair of dice is rolled and the sum of the dice is recorded, determine the...
A pair of dice is rolled and the sum of the dice is recorded, determine the probability that: a) The sum is greater than 5 given the first dice is a 4. b) The sum is greater than 9 given the second dice is a 6. c)The sum is even given the second dice is a 4 d) The sum is odd given the first dice is a 3 e) A double is rolled given neither dice is a 4...
complete the code to determine the highest score value in python import random #variables and constants...
complete the code to determine the highest score value in python import random #variables and constants MAX_ROLLS = 5 MAX_DICE_VAL = 6 #declare a list of roll types ROLL_TYPES = [ "Junk" , "Pair" , "3 of a kind" , "4 of a kind" ] pScore = 0 cScore = 0 num_Score = int( input ("Enter a number of round: ") ) print ("\n") count = 0 while count < num_Score: #set this to the value MAX_ROLLS pdice = [0,0,0,0,0]...
Three fair dice (black, white and red) are tossed simultaneously and the value recorded as an...
Three fair dice (black, white and red) are tossed simultaneously and the value recorded as an ordered triple y = (yb, yw, yr), which is a point in S. Let A1, A2, A3 be the events A1 = {(yb, yw, yr) : yb = yw} A2 = {(yb, yw, yr) : yb = yr} A3 = {(yb, yw, yr) : yw = yr} (i) What is the sample space S for this experiment? How many points or elementary events does...
Three fair dice (black, white and red) are tossed simultaneously and the value recorded as an...
Three fair dice (black, white and red) are tossed simultaneously and the value recorded as an ordered triple y = (yb, yw, yr), which is a point in S. Let A1, A2, A3 be the events A1 = {(yb, yw, yr) : yb = yw} A2 = {(yb, yw, yr) : yb = yr} A3 = {(yb, yw, yr) : yw = yr} For the set-up described in the preceding question, let 1 ≤ t ≤ 18 be a positive...
Use the binomial distribution to determine which of the following three games has the highest probability...
Use the binomial distribution to determine which of the following three games has the highest probability of winning. What is the minimum rational price you should charge to play this game if you must pay a winner $5.00? Game 1: throw a single die 6 times. You win if you roll a 1 at least once. Game 2: throw a single die 12 times. You win if you roll a 1 at least twice. Game 3: throw a single die...
An experiment was done to determine if a pair of dice is “fair”, that is, the...
An experiment was done to determine if a pair of dice is “fair”, that is, the probability that each number on each die is the same. Tom tosses the dice 50 times and determines that the mean sum of the sample is 6.6, with a standard deviation of 1. 133. According to the mechanics of tossing two dice, the mean should be 7. Determine if this is a fair dice at the .05 level of significance. Also determine the p-value....
2. Three fair dice are rolled. Let X be the sum of the 3 dice. (a)...
2. Three fair dice are rolled. Let X be the sum of the 3 dice. (a) What is the range of values that X can have? (b) Find the probabilities of the values occuring in part (a); that is, P(X = k) for each k in part (a). (Make a table.) 3. Let X denote the difference between the number of heads and the number of tails obtained when a coin is tossed n times. (a) What are the possible...
are the outcomes of three rolled dice equally likely
are the outcomes of three rolled dice equally likely
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT