Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include // For rand and srand #include // For the time function using namespace std; class Die { //IMPLEMENT THE DIE CLASS //IMPLEMENT

image text in transcribed

#include

#include

#include // For rand and srand

#include // For the time function

using namespace std;

class Die

{

//IMPLEMENT THE DIE CLASS

//IMPLEMENT THE DIE CLASS

//IMPLEMENT THE DIE CLASS

};

int main()

{

// IMPLEMENT THE MAIN FUNCTION

// IMPLEMENT THE MAIN FUNCTION

// IMPLEMENT THE MAIN FUNCTION

system("PAUSE");

return 0;

}

For your second programming assignment, you will be writing an object oriented C++ program that lets the user play against the computer in a variation of the popular blackjack card game. In this variation of the game, two six-sided dice are used instead of cards. The dice are rolled, and the player tries to beat the computer's hidden total without going over 21. Each round of the game is performed as an iteration of a loop that repeats as long as the player agrees to roll the dice, and the player's total does not exceed 21. At the beginning of each round, the program will ask the user whether they want to roll the dice to accumulate points. During each round, the program simulates the rolling of two six-sided dice. It rolls the dice first for the computer, and then it asks the user if he or she wants to roll. The loop keeps a running total of both the computer and the user's points. .The computer's total should remain hidden until the loop has finished After the loop has finished, the computer's total is revealed, and the player with the most points without going over 21 wins. Neither player wins if there is a tie or if both players go over 21. You will be implementing a class named Die (singular form of dice). Design the class from the following UML diagram: Die sides: int / Number of sides on the die -value: int//The die's value > +Die(numSides: int) +setSides(numSides: int) +roll() +getSides(): int +getValue): int

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

Practical Oracle8I Building Efficient Databases

Authors: Jonathan Lewis

1st Edition

0201715848, 978-0201715842

More Books

Students also viewed these Databases questions