NEEDED IN CLASS AND OBJECTS The dice game you will build involves a set of five
ID: 3528936 • Letter: N
Question
NEEDED IN CLASS AND OBJECTS
The dice game you will build involves a set of five 6-sided dice, which you should store in a vector of Spinner objects: Set up each dice object as follows: The values are simply the integers 1 through 6. The labels should be text "pictures" that represent each number. (It doesn't matter what they look like, as long as it is obvious what each picture represents). The player starts with 0 points, and the game has 3 rounds. Each round of the game consists of the steps below. Roll all dice, then display their labels in a sequence. Exactly two times, offer the user the opportunity to re-roll one of the dice. Each time they re-roll, display all of the dice labels again. After both re-rolls, award points based on these rules: If there is a sequence of 4 dice with adjacent values, either increasing or decreasing - for instance, 3,4,5,6 or 4,3,2,1 - the player gains 100 points, If three or more of the dice match exactly, the player gains 50 points. Otherwise, the player gains points equal to the sum of all dice values. At the end of each round, display the players current score.Explanation / Answer
Please rate with 5 stars :) Took a long time to write this for you :) This is the code that uses a random wheel instead of the dice, the rest of the concept is same :) //This is the H file #ifndef RANDOMWHEEL_H #define RANDOMWHEEL_H #include #include using namespace std; class RandomWheel { private: int numberOfItems; int currentItem; vector itemValues; vector itemLabels; public: // CONSTRUCTOR RandomWheel(int itemCount, int values[], string labels[]); // MUTATORS void Spin(); // ACCESSORS int GetCurrentValue() const; string GetCurrentLabel() const; }; #endif // RANDOMWHEEL_H //This is the ccp file #include "RandomWheel.h" #include #include // CONSTRUCTOR RandomWheel::RandomWheel(int itemCount, int values[], string labels[]) { srand(time(0)); numberOfItems = itemCount; currentItem = 0; for (int i = 0; i input; if (input != "y") break; fruitSpinner.Spin(); coutRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.