Answered step by step
Verified Expert Solution
Link Copied!

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.

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions

Question

Understand the third phase of the writing process: revision.

Answered: 1 week ago