Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!