( Java Programming )
Write an application to simulate the rolling of two dice. The application should use an object of class Random once to roll the first die and again to roll the second die. The sum of the two values should then be calculated. Each die can show an integer value from 1 to 6, so the sum of the values will vary from 2 to 12, with 7 being the most frequent sum, and 2 and 12 the least frequent. Figure 1 shows the 36 possible combinations of the two dice. Your application should roll the dice 36,000,000 times. Use a one-dimensional array to tally the number of times each possible sum appears. Display the results in tabular format.
Here is the code for the following problem :
Code :
import java.util.Random;
public class Main
{
//execeuionof the program starts from here
public static void main(String[] args) {
//1D-array stores all possible
sum
//each index is considered as
possible sum starts from 0
int[] possible_sum = new
int[13];
//create the object of Random
class
Random random = new Random();
//loop the dice pair for
36,000,000
for(int i=1; i<=36000000;
i++)
{
int dice1 = random.nextInt(6) +
1;
int dice2 = random.nextInt(6) +
1;
//increament the index equla to the
sum of dice
possible_sum[dice1 +
dice2]++;
}
//print the array, which represent
how many times each sum appesr
for(int i=2; i<13; i++)
{
System.out.println("Sum : "+ i + "
Appear : " + possible_sum[i]);
}
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------
Screenshots :

Output :

( Java Programming ) Write an application to simulate the rolling of two dice. The application...
please do it in C++ Write a program that simulates the rolling of two dice. The program should use rand to roll the first die and should use rand again to roll the second die. The sum of the two values should then be calculated. [Note: Each die can show an integer value from 1 to 6, so the sum of the two values will vary from 2 to 12, with 7 being the most frequent sum and 2and 12...
Write a java program that simulates the rolling of four dice. The program should use random number generator to roll dice. The sum of the four values should then be calculated. Note that each die can show an integer value from 1 to 6, so the sum of the four values will vary from 4 to 24, with 14 being the most frequent sum and 4 and 24 being the least frequent sums. Your program should roll the dice 12,960...
1T (startIndex< size) ( 22 23 someFunction(b, startIndex +1, size); printf("%d ", b[startIndex]); 24 25 26 (Dice Rolling) Write a program that simulates the rolling of two dice. The program should rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated. [Note: Because each die can show an integer value from 1 to 6, then the sum of the two values will vary from 2 to 12, with 7...
in C please, Write the code to simulate rolling three dice and find the sum of the top three faces. Repeat rolling the three dice 10,000 times. Use an array called frequency to have the count of each sum. Pass this array to a function that calculates the maximum number that appears in this array. Print this maximum in main.
Java programming Write a simulation of the Craps dice game. Craps is a dice game that revolves around rolling two six-sided dice in an attempt to roll a particular number. Wins and losses are determined by rolling the dice. This assignment gives practice for: printing, loops, variables, if-statements or switch statements, generating random numbers, methods, and classes. Craps game rules: First roll: The first roll (“come-out roll”) wins if the total is a 7 or 11. The first roll loses...
PYTHON: Dice Rolling Write a script that takes input for the number of dice to roll and for the number of sides for the dice. Roll that many n-sided dice and store the values an array. Take the number of sides of the dice and the number of dice as typed inputs from the user. Output should be a comma separated list of the die numbers with no spaces like this: 6,4,1,3,1 Write a script that will simulate the roll...
Write a C PROGRAM that will simulate rolling a die. When rolling a die, one will get a die face value of 1-6. We can use rand function and math ceiling function to get a random number of 1-6 generated. The program will simulating rolling 5 dice simultaneously and store their face values into an array of size 5. The program will keep rolling the dice and print the following: 1. All face values in one line 2. If any...
Rolling Dice 2. A pair of dice is rolled. Here is the sample space (all of the possible outcomes) of rolling a pair of dice. First Die a) In how many different ways can we roll a 7 (as the sum of the two dice)? What is the probability of rolling a 7? 2 3 4 5 6 7 3 4 5 6 7 8 b) In how many ways can we roll a sum that is divisible by 3?...
7-Sp19-Gunderson > Assignments> A09 Dice A09 Dice Due Apr 2 by 11:59pm Points 40Submitting a file upload Part 1. Dice (25 points) Dice.pdfy Create a video recording that shows the code of class Dice. After showing the code compile and run the program. Adjust the size of the output window to provide enoughroom for the whole output. The length of the video should be about 1 minute. Submission Submit both the video recording and the java file 0774 item id-8881416...
Write a Java pseudocode for a 2-dice game. This game will roll the two dice together for 100 times. In each time, it will display the face values from both dice. The program will count how many times (out of these 100 attempts) did the two dice generate a total point of 10 or above, and display the result at the end. In a word document, PPT file or a PDF file.