Write a class definition for a Die class that represents a six-sided playing die. Include a field to hold the current value (the die side facing up), and functions to get and set the value. Also...


Write a class definition for a Die class that represents a six-sided playing die. Include a


field to hold the current value (the die side facing up), and functions to get and set the


value. Also include a static, constant field that holds the maximum die value (6). Write a


program that plays a game of “21” by instantiating a Die object and using it to take turns


“rolling” for the computer and for the player using a random number. (See Appendix E


for information on generating random numbers in a specified range.) Keep a running


total for the computer and for the player. The goal is to get as close to a total of 21 without going over. The player can choose to stop rolling at any time. The computer will stop


rolling when its total reaches 19 or more. Declare a winner when one opponent goes over


21 or both opponents quit. If both opponents quit with the same total (19, 20, or 21), then


declare the player to be the winner. Save the program as TwentyOneWithDice.cpp.



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here