Problem

Programming Exercise 19 prompted the user to input the number of times the dice were to...

Programming Exercise 19 prompted the user to input the number of times the dice were to be rolled and the desired sum, and the program output the number of times the desired sum occurred. Modify Programming Exercise 19 as follows: Suppose you roll 4 dice 1000 times. Store the sum of the numbers rolled in each roll into an array, and then use this array to print a bar graph (similar to the bar graph in the Programming Example Data Comparison (Chapter 6)). Test run your program using 4, 5, and 6 dice and the number of rolls 2500, 3000, and 5000. What type of curve does the shape of your bar graph resemble?

REFEENCE:

Suppose you roll a set of n dice. Then the smallest sum is n and the largest sum is 6n. For example, if n = 10, then the smallest sum is 6 and the largest sum is 60. Let m be the desired sum of the numbers rolled. Then n ≤ m ≤ 6n. If n = 10, then 6 ≤ m ≤ 60. Write a program that uses the class die, of Example 10-9, to roll 10 dice. (Use an array of size 10 to implement 10 dice.) The program prompts the user to enter the desired sum and the number of times the dice are to be rolled. The program outputs the number of times the desired sum was rolled and the probability of rolling the desired sum. Test run your program to roll the 10 dice 10,000, 100,000, 1,000,000, 10,000,000, and 100,000,000 times with the desired sums 6, 25, 40, and 60. How many times was the sum 6 rolled? How many times was the sum 60 rolled?

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT