Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that simulates rolling two dice using the following steps: 1. Prompt the user for the number of sides for two dice. 2.
Write a program that simulates rolling two dice using the following steps: 1. Prompt the user for the number of sides for two dice. 2. "Roll" the dice three times by generating a random number between 1 (inclusive) and the number of sides (inclusive) 3. Keep track of the sum of the rolls for each die and output the sum and average for each die. Total possible points: 11 points: a) Prompt the user for the side of each die (3 points) b) Proper use of Random number generation (3 points) c) Sum of the rolls for each die (2 points) d) Average of the rolls for each die (2 points) e) Formatted Output (1 point) Sample Output: How many sides does die 1 have? 6 How many sides does die 2 have? 20 Die I first roll 5. Die 2 first ro11 14. Die 1 sec nd roll = 1. Die 2 second roll 20 Die 1 third roll 3. Die 2 third roll- 9. Die 1 rolled a total of 9 and rolled 3 on average Die 2 rolled a total of 43 and rolled 14.333 on average
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started