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....
-
Walmart tried to be successful in Germany and failed. However, it has been very successful in Mexico. How has the implementation of NAFTA affected Walmart's success in Mexico?
-
Given the financial information for the A.E Neuman Corporation answer the following question: a) Prepare a statement of cash flows for the year ending 2007 b) What is the dividend payout ratio for...
-
Question: Rap artist Ice-T and his band, Body Count, recorded a song called "Cop Killer," in which the singer gleefully anticipates slitting a policeman's throat. (The lyrics to this song are readily...
-
In 2016, Lee Inc. billed its customers $62,000 for services performed. The company collected $51,000 of the amount billed. Lee incurred $39,000 of other operating expenses on account. Lee paid...
-
Caspian Sea Drinks is considering buying the J-Mix 2000. It will allow them to make and sell more product. The machine cost $1.11 million and create incremental cash flows of $790,709.00 each year...
-
In a survey, adults were asked to answer yes or no to the question Do you regularly watch the evening TV news? Some of the results from the survey are detailed in the Venn diagram opposite. One adult...
-
Accounting Questions: What is the difference between cash basis and accrual basis accounting? How does the matching principle impact financial statements? Explain the concept of depreciation and its...
-
Fill in the Blank. The application of Lagrange's equations requires the availability of _________ expressions.
-
Fill in the Blank. During free vibration of an undamped system, all coordinates will have _________ motion.
-
Add interval splitting to the Python interval class in order to minimize the dependency problem. Automatically split intervals into \(n\) parts and evaluate a function on each of those parts...
-
Fill in the Blank. The stiffness matrix is positive definite only if the system is _________.
-
Fill in the Blank. The motion of a two-degree-of-freedom system is described by two __________ coordinates.
-
Identify three peer-reviewed research articles that review the toxic effects of a chemical substance on a specific organ or organ system. Create an annotated bibliography using these resources. The...
-
Outline a general process applicable to most control situations. Using this, explain how you would develop a system to control home delivery staff at a local pizza shop.
-
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...
-
Describe why a small-cap stock is more likely to be a growth stock rather than an income stock.
-
Many investors buying stocks are not individuals, but institutions, such as retirement plans and mutual funds, which have extremely large amounts of money to buy and sell large blocks of stock.
-
The capital gains received on stock sales is considered income, and you have to pay taxes on it. To encourage people to invest and to hold on to those investments, the U.S. government taxes capital...
Study smarter with the SolutionInn App