Create a class that manages a dice matching game. There are 3 dice randomly being rolled....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Create a class that manages a dice matching game. There are 3 dice randomly being rolled. Create a default constructor that randomly assigns values to the dice(1-6), and a deconstructor that prints when the object is being destroyed. Create functions that display the dice, and allows the user to reroll one of the dice. Additionally check to see how many of the dice match. For this lab you must dynamically allocate an instance of the classes using only smart pointers. The object will be managed by using two shared pointers. The shared pointers will be tested to see if they point to an object then reset() and then display the number of shared objects in its grouping. Please refer to the example output on the back. Useful Code: #include <time.h> srand(time(0)); rollADie = rand() % 6 + 1; Dice #1 is 3 Dice #2 is 3 Dice #3 is 3 all three dice are equal //seed the timer to reset // generate number in the range of 1 - 6 Sample Cases To Consider Dice #1 is 2 Dice #2 is 2 Dice #3 is 5 two dice are equal Dice #1 is 3 Dice #2 is 6 Dice #3 is 4 no dice are equal Create a class that manages a dice matching game. There are 3 dice randomly being rolled. Create a default constructor that randomly assigns values to the dice(1-6), and a deconstructor that prints when the object is being destroyed. Create functions that display the dice, and allows the user to reroll one of the dice. Additionally check to see how many of the dice match. For this lab you must dynamically allocate an instance of the classes using only smart pointers. The object will be managed by using two shared pointers. The shared pointers will be tested to see if they point to an object then reset() and then display the number of shared objects in its grouping. Please refer to the example output on the back. Useful Code: #include <time.h> srand(time(0)); rollADie = rand() % 6 + 1; Dice #1 is 3 Dice #2 is 3 Dice #3 is 3 all three dice are equal //seed the timer to reset // generate number in the range of 1 - 6 Sample Cases To Consider Dice #1 is 2 Dice #2 is 2 Dice #3 is 5 two dice are equal Dice #1 is 3 Dice #2 is 6 Dice #3 is 4 no dice are equal
Expert Answer:
Answer rating: 100% (QA)
include include include include class DiceGame private int dice public DiceGame dice new int3 s... View the full answer
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
What are the assumptions used in CVP analysis and why do we make them? What role does sensitivity analysis play in CVP analysis? What possible benefits or risks do these pose for management? In a...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
You are required to write a Python program that will manage character (heroes and villain) information. Character (hero and villain) information will be stored in a text file that will be read in...
-
Find the derivative of the function. y = e 2x tan 2x
-
What is the percent error in specific volume if the ideal gas model is used to represent the behavior of superheated ammonia at 40C, 500 kPa? What if the generalized compressibility chart,...
-
Marquis Westbury invested $49,000 in the Trenton and Rainwater partnership for ownership equity of $49,000. Prior to the investment, equipment was revalued to a market value of $358,000 from a book...
-
A biologist decided that she wanted to have $\$ 54,267.89$ in her account in 10 years, and she found a bank which compounded monthly at $6 \%$. What are her monthly payments to achieve her goal of...
-
You are considering investing in Dakotas Security Services. You have been able to locate the following information on the firm: total assets are $32 million, accounts receivable are $4.4 million, ACP...
-
What are the two basic timing strategies? What is the intent of each? If nontax factors are irrelevant, what is the best course of action in timing strategy when you expect tax rate to increase in...
-
Client's Facts: The client found a check written out to cash in the amount of $750. The check was completely made out when he found it. He took it to the bank, signed it on the back as instructed by...
-
Compute the integral yz dV , where E is the solid region bounded by the paraboloid x=( +=') and the plane x 4.
-
According to the Oil & Gas Journal, the proven oil reserves existing in the world in 2012 consisted of 1,525 billion barrels. In that year, the U.S. Energy Information Administration reported that...
-
This case demonstrates the adverse consequences that result when a pharmacist overzealously applies the corresponding responsibility doctrine without bothering to determine the facts. It also shows...
-
Suppose that the advent of employment websites enables job-seekers to find suitable jobs more quickly. What effect will this have on the unemployment rate over time? Also suppose that these websites...
-
In this case, the pharmacist, Hayes, has been charged with dispensing invalid prescriptions in violation of the corresponding responsibility doctrine. The government contends that Hayes should be...
-
Output in the economy of Erewhon has grown 3% per year over the past 30 years. The labor force has grown at 1% per year, and the quantity of physical capital has grown at 4% per year. The average...
-
What effect will overstating 2020's ending inventory by $1,009,000 have on 2021's ending retained earnings? Group of answer choices No effect; the RE balance will be correct. RE will be overstated by...
-
Conduct a VRIO analysis by ranking Husson University (in Maine) business school in terms of the following six dimensions relative to the top three rival schools. If you were the dean with a limited...
-
You send messages or information to an object through its _____________. a. Fields b. Methods c. Classes d. Type
-
When you code an if statement within another if statement, the statements are ____________. a. Notched b. Nested c. Nestled d. Sheltered
-
Convert the QuartsToGallons program to an interactive application. Instead of assigning a value to the number of quarts, accept the value from the user as input. Save the revised program as...
-
Which of the following function(s) is/are carried out by piRITS or piRISC? a. Inhibits transcription of TEs b. Causes the degradation of TE RNA c. Causes chromosome breakage d. Both a and b are...
-
Scientists propose that the first macromolecules in protobionts were a. DNA molecules. b. RNA molecules. c. proteins. d. all of the above.
-
In the CRISPR-Cas system, what does tracrRNA bind to? a. crRNA and Cas1 protein b. crRNA and Cas2 protein c. crRNA and Cas9 protein d. Cas1 and Cas2 proteins
Study smarter with the SolutionInn App