CST-210 5 Dice, 3 Rolls The purpose of this assignment is to assess your ability to...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
CST-210 5 Dice, 3 Rolls The purpose of this assignment is to assess your ability to do the following: • Implement a class based on a UML class diagram. • Utilize objects in a software solution. Write a program based on a logical model (flowchart). In this assignment, you will write a program that simulates a dice game. 1. Start by implementing the Die class using the following UML model and data/method descriptions. Die sides : int value: int + Die (int) : + Die(): + roll(): void +getValue(): int //# of sides on the die int sides; //face-value of the die //1<=value<sides int value; //initialize the sides with the parameter //intialize the value to e Die (int); //initialize sides to 6 //initialize value to e Die(); //roll the die and update value void roll(); //return the face-value of the die int getValue(); 2. Next, add a .cpp file to your project. Call this file DiceGame.cpp. This file will contain three functions: main (), a function to showDice (), and a function to get TotalScore (), as shown below. In function main(), create an array of five 6- sided dice. Write a loop that iterates over the array and rolls each die in the array. #include <iostream> #include "Die.h" using namespace std; void showDice (Die[]); int getTotalScore (Die[]); int main() { ... } Function main int getTotalScore (Die theDice[]) { ... } void showDice (Die theDice[]) {... Function headers 3. Write the implementation for the method show Dice (). This method should display the dice in the following format: where the numbers on the top line indicate each die and the numbers on the bottom line indicate the face-value of the corresponding die. Test your method by passing the array of dice, created in main (). C:\Users\Lydia\Source\Rep Implementations 12345 55622 4. Write the code that allows the user to re-roll three times. Use the provided flowchart as a guide. The parts of the flowchart that appear in a rectangle with double lines at the ends are the processes that require additional logical development. start create myDice [5] end roll all the dice false j++ show result of the roll 1:40 3 input numToRo11/ j:40 j<numToRo11? input dieToRo11/ roll indicated die false 1++ show the total score for the roll When you have finished your program, create a 3-to 5-minute video in which you 1. Run your program, 2. Explain the output produced, 3. Discuss the development process, including challenges and how you attempted to resolve them, 4. Tell how your project demonstrates the following assignment objective: "Implement a class based on a UML class diagram." To do this, explain how your class follows the UML diagram. Remember, you are explaining your work and NOT READING YOUR CODE. BEFORE you submit, make sure that • Every file contains your name and statement of own work. • Your code contains procedural comments comments that explain WHAT your programs are doing, as opposed to HOW they are doing it. Submit the following: • A text document titled Links.txt that contains a link to your video. Your source code. CST-210 5 Dice, 3 Rolls The purpose of this assignment is to assess your ability to do the following: • Implement a class based on a UML class diagram. • Utilize objects in a software solution. Write a program based on a logical model (flowchart). In this assignment, you will write a program that simulates a dice game. 1. Start by implementing the Die class using the following UML model and data/method descriptions. Die sides : int value: int + Die (int) : + Die(): + roll(): void +getValue(): int //# of sides on the die int sides; //face-value of the die //1<=value<sides int value; //initialize the sides with the parameter //intialize the value to e Die (int); //initialize sides to 6 //initialize value to e Die(); //roll the die and update value void roll(); //return the face-value of the die int getValue(); 2. Next, add a .cpp file to your project. Call this file DiceGame.cpp. This file will contain three functions: main (), a function to showDice (), and a function to get TotalScore (), as shown below. In function main(), create an array of five 6- sided dice. Write a loop that iterates over the array and rolls each die in the array. #include <iostream> #include "Die.h" using namespace std; void showDice (Die[]); int getTotalScore (Die[]); int main() { ... } Function main int getTotalScore (Die theDice[]) { ... } void showDice (Die theDice[]) {... Function headers 3. Write the implementation for the method show Dice (). This method should display the dice in the following format: where the numbers on the top line indicate each die and the numbers on the bottom line indicate the face-value of the corresponding die. Test your method by passing the array of dice, created in main (). C:\Users\Lydia\Source\Rep Implementations 12345 55622 4. Write the code that allows the user to re-roll three times. Use the provided flowchart as a guide. The parts of the flowchart that appear in a rectangle with double lines at the ends are the processes that require additional logical development. start create myDice [5] end roll all the dice false j++ show result of the roll 1:40 3 input numToRo11/ j:40 j<numToRo11? input dieToRo11/ roll indicated die false 1++ show the total score for the roll When you have finished your program, create a 3-to 5-minute video in which you 1. Run your program, 2. Explain the output produced, 3. Discuss the development process, including challenges and how you attempted to resolve them, 4. Tell how your project demonstrates the following assignment objective: "Implement a class based on a UML class diagram." To do this, explain how your class follows the UML diagram. Remember, you are explaining your work and NOT READING YOUR CODE. BEFORE you submit, make sure that • Every file contains your name and statement of own work. • Your code contains procedural comments comments that explain WHAT your programs are doing, as opposed to HOW they are doing it. Submit the following: • A text document titled Links.txt that contains a link to your video. Your source code.
Expert Answer:
Answer rating: 100% (QA)
Please find the updated Die class and Main class attached below Dieh class Die private int sides int ... View the full answer
Related Book For
Concepts In Federal Taxation
ISBN: 9780324379556
19th Edition
Authors: Kevin E. Murphy, Mark Higgins, Tonya K. Flesher
Posted Date:
Students also viewed these programming questions
-
research the web and find the nondestructive inspection Eddy Current Testing (ET) and discuss the advantages and disadvantages of utilizing non-destructive testing in determining aircraft...
-
Zhang incorporated her sole proprietorship by transferring inventory, a building, 100 percent of the corporation's stock. The property transferred to the corporati and adjusted tax bases: FMV...
-
CST-210 Slot Machine Code Analysis The purpose of this assignment is to assess your ability to do the following: Model software objects with UML diagrams (utilize abstraction in software design)....
-
Builder Products, Incorporated, uses the weighted-average method in its process costing system. It manufactures a caulking compound that goes through three processing stages prior to completion....
-
Mazlin Limited purchased a machine on account on April 2, 2015, at an invoice price of $360,000. On April 4, it paid $2,000 for delivery of the machine. A one-year, $4,000 insurance policy on the...
-
At December 31, 2021, Burr AG owes 500,000 on a note payable due February 15, 2022. (a) If Burr expects to refinance the obligation by issuing a long-term note on February 14 and using the proceeds...
-
When to file a motion to strike?
-
Explain why such forecasting devices as moving averages, weighted moving averages, and exponential smoothing are not well suited for data series that have trends.
-
What aspects of the Confucian and Daoist teaching still relevant in the 2 1 st century?Explain
-
What is the common problem in Blockchain? a . . two general problem b . . three general problem c . . one general problem d . . six general problem
-
]Solve the following perfect information game using backwards induc- tion. As a part of your answer, you need to state what each player chooses at each node and why. b 2 4,2 2 2 -12 } 3,0 0,2 n 5 2 e...
-
You have been given the job of organising the floor coverings for a new Granny Flat. Both bedrooms, hallway and living area are to be carpeted, whilst the kitchen, bathroom and laundry will be tiled....
-
Light of 600.0 nm is incident on a single slit of width 6.5 m. The resulting diffraction pattern is observed on a nearby screen and has a central maximum of width 3.5 m. What is the distance between...
-
Critically discuss the four change management approaches that farmers should adopt as part of digital transformation and include a brief description of each approach.
-
Cue balls on coin operated billiard tables are either larger than the numbered balls or are magnetic. This allows them to be returned for play in the event they are accidentally pocketed (i.e.,...
-
Mention the equipment you will find in a digital survey office?
-
Suppose that the electrical potential at the point (x, y, z) is E(x, y, z) = x + y - 2z. What is the direction of the acceleration at the point (1,3,2)?
-
Hassad owns a rental house on Lake Tahoe. He uses a real estate firm to screen prospective renters, but he makes the final decision on all rentals. He also is responsible for setting the weekly...
-
Taylor dies on February 19 of the current year. Among the assets in his estate are 500 shares of Dane Company preferred stock. Taylor paid $14 per share for the stock on August 13, 2001. Market...
-
Claude is a CPA and a partner with SKH and Associates, a regional public accounting firm. In September 2009, Brokaw Technologies approached one of his clients, Walter Fenner, about acquiring 100...
-
Prove: 'Bernoulli's equation is a restrictive form of energy equation'.
-
What are the assumption made for the establishment of Bernoulli's equation?
-
A shell and tube heat exchanger is used to cool lubricating oil by water at the rate of \(120 \mathrm{~kg} / \mathrm{min}\). The oil enters the heat exchanger at \(343 \mathrm{~K}\) and leaves at...
Study smarter with the SolutionInn App