Question
Need some help writing the class code for Die.h. The description of the class and my attempt at it is below: Program that lets the
Need some help writing the class code for Die.h. The description of the class and my attempt at it is below:
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.
You
will be implementing a class named Die (singular form of dice).
Design
the class from the following UML diagram - your class should follow this UML
diagram EXACTLY:
//Robert Furger Programing Assignment #2, 200 #include#include class Die { public: Die (int numSides) { sides = numSides; srand(time(NULL));//seed the randam generator value = rand() % sides + 1;//produces an initial roll of die based on the //number of sides } void setSides(int numSides) { sides = numSides; } void roll() { srand(time(NULL));//seed the randam generator value = rand() % sides + 1;//produces an initial roll of die based on the //number of sides } int getSides() { return sides; } int getValue() { return value; } private: int sides; // number of sides on the die int value; // the die's value };
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started