Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first die and second die, respectively. The sum of the two values should then be calculated....


Write a program that simulates the rolling of two dice. The program should use rand twice to roll the first<br>die and second die, respectively. The sum of the two values should then be calculated. [Note: Because<br>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<br>7 being the most frequent sum and 2 and 12 the least frequent sums.] Figure below shows the 36<br>possible combinations of the two dice. Your program should roll the two dice 36,000 times Use a one-<br>dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular<br>format. Also, determine if the totals are reasonable; i.e., there are six ways to roll a 7, so approximately<br>one-sixth of all the rolls should be 7.<br>5<br>3<br>4.<br>56 7<br>2<br>4 5 6 7 8<br>3<br>4 56 7 8 9<br>5 6 7 8 9 10<br>4<br>5<br>7 8 9 10 11<br>6 7 8 9 10 11 12<br>

Extracted text: Write a program that simulates the rolling of two dice. The program should use 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 being the most frequent sum and 2 and 12 the least frequent sums.] Figure below shows the 36 possible combinations of the two dice. Your program should roll the two dice 36,000 times Use a one- dimensional array to tally the numbers of times each possible sum appears. Print the results in a tabular format. Also, determine if the totals are reasonable; i.e., there are six ways to roll a 7, so approximately one-sixth of all the rolls should be 7. 5 3 4. 56 7 2 4 5 6 7 8 3 4 56 7 8 9 5 6 7 8 9 10 4 5 7 8 9 10 11 6 7 8 9 10 11 12

Jun 06, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here