Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that simulates rolling dice. You are playing against the computer. The computer will roll the dice by randomly generating a number between

Write a program that simulates rolling dice. You are playing against the computer. The computer will roll the dice by randomly generating a number between 1 and 6 inclusive. You will then be asked if you want to roll the dice (Do you want to roll the dice?). If you respond with Y or y, the dice is rolled by randomly generating a number between 1 and 6. Print the number generated (I rolled: number). If your roll matches the initial computer roll, then display I rolled:numberthen I WIN!on a new line and quit the program. If the roll does not match, you will be asked to roll again (Do you want to roll the dice?). If you respond with N or n, the game ends. Responding with something other than Y or y or N or n simply re-prompts the user for another roll. This program will be graded manually. There are no pre-defined test cases.

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

Relational Database Design A Practical Approach

Authors: Marilyn Campbell

1st Edition

1587193175, 978-1587193170

More Books

Students also viewed these Databases questions

Question

Give the general formula for a confidence interval.

Answered: 1 week ago