Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die sides int value: int + Die(numSides: int) roll() : void + + getSides (): int + getValue(): int Specifications: roll() Simulates the rolling of the die. In the method create an object of the Random class. Generate a random number that is appropriate for the particular die. Hint: Use a method from the Random class that allows the number of sides to be passed as an argument. Observations: What does the Die know about itself? What can the Die do? Why are the setSides() and setValues() methods missing? Write a tester class that interacts with the Die class. • Input: Ask the user for the number of sides of one die. For now, both die must have the same number of sides and it must be 6. Process: Create 2 Die objects. Call the constructors appropriately. Simulate rolling the die for each object. • Output: Print appropriate messages to the user. Programming Exercise # 1. How much did you know about the topic before we started? 2. Have you changed any ideas you used to have on this topic? 3. What was especially satisfying to you about either the process or the finished product? Programming Exercise #1: Die Class Write a Die class according to the UML Diagram. - Die sides int value: int + Die(numSides: int) roll() : void + + getSides (): int + getValue(): int Specifications: roll() Simulates the rolling of the die. In the method create an object of the Random class. Generate a random number that is appropriate for the particular die. Hint: Use a method from the Random class that allows the number of sides to be passed as an argument. Observations: What does the Die know about itself? What can the Die do? Why are the setSides() and setValues() methods missing? Write a tester class that interacts with the Die class. • Input: Ask the user for the number of sides of one die. For now, both die must have the same number of sides and it must be 6. Process: Create 2 Die objects. Call the constructors appropriately. Simulate rolling the die for each object. • Output: Print appropriate messages to the user. Programming Exercise # 1. How much did you know about the topic before we started? 2. Have you changed any ideas you used to have on this topic? 3. What was especially satisfying to you about either the process or the finished product?
Expert Answer:
Answer rating: 100% (QA)
Based on the provided UML diagram and specifications you are tasked with creating a Die class that s... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Of all the outstanding shares of common stock in Major Corporation, Mark owns 710 of the shares; his grandfather owns 100 shares; his father owns 110 shares; his ex-wife owns 700 shares; Minor...
-
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...
-
Nine-step approach to case analysis When working on cases and problems in your , it is recommended that you follow this nine-step approach: Skim the case. Read the case closely. Identify problems and...
-
How would your answers in Problem 48 change if partnership revenues were $100,000 instead of $150,000? Data From Problem 48: The KL Partnership is owned equally by Kayla and Lisa. Kaylas basis is...
-
Suppose you take a random sample from a normal population and you want to determine whether there is sufficient statistical evidence to claim that the population variance differs from a corresponding...
-
As you study accounting, you will become increasingly familiar with a variety of generally accepted accounting principles. Already, you are beginning to appreciate some of the fundamental principles,...
-
On November 1, 2020, Drucker Co. acquired the following investments in equity securities measured at FV-NI. Kelly Corporation-500 shares of common stock (no-par) at \(\$ 60\) per share. Keefe...
-
FIFO and LIFOPeriodic and Perpetual Inventory information for Part 311 of Seminole Corp. discloses the following information for the month of June. June 1 Balance 300 units @ $10 June 10 Sold 200...
-
Snake Creek Company has a trusted employee who, as the ownersaid, ??handles all of the bookkeeping and paperwork for thecompany.? This employee is responsible for counting, verifying, andrecordi 2...
-
The Foxridge Investment Group buys and sells rental income properties in southwest Virginia. Bill Hunter, president of Foxridge, has asked for your assistance in analyzing a small apartment building...
-
Suppose that a customer at Bank of America demands that $280,000 be transferred to a competing commercial bank because the competing commercial bank is offering higher deposit rates. What difficulty...
-
Samantha loaned$300,000to a small business at8.25%compounded semi-annually for3year and4months. a. How much would the business have to repay Samantha at the end of the period? b. How much interest...
-
Explain how the economic conditions of Australia will affect the growth and planning of Telstra and optus carriers/service providers Evaluate how the political influences impact Telstra and optus...
-
Honesty Production In. has manufactured 100,000 units of product AA in May at the following costs: Labor of Php250,000 of which 92% represents direct labor Materials of Php184,000 of which 90%...
-
A company purchases a piece of manufacturing equipment for rental purposes. The expected income is $10,000 the first year and increases $100 every year thereafter. Its useful life is 6 years....
-
(i) Consider a structural steel with yield stress y = 350 M Pa. Estimate the specimen dimensions required for a valid K test; i.e. a. W and the maximum thickness B. Assume that the test specimen is a...
-
You will create an amortization schedule for Loan Option 2 in cells C 1 2 :F 3 5 . All payments are end - of - the - period payments. Be sure that all formulas and functions result in a positive...
-
Suppose the S&P 500 futures price is 1000, = 30%, r = 5%, = 5%, T = 1, and n = 3. a. What are the prices of European calls and puts for K = $1000? Why do you find the prices to be equal? b. What...
-
You sell the book C++ for Fools. Write a program that has you enter a years worth of monthly sales (in terms of number of books, not of money).The program should use a loop to prompt you by month,...
-
The Benevolent Order of Programmers maintains a collection of bottled port. To describe it, the BOP Portmaster has devised a Port class, as declared here: #include using namespace std; class Port {...
-
The Wine class has a string class object member (see Chapter 4) that holds the name of a wine and a Pair object (as discussed in this chapter) of valarray objects (as discussed in this chapter).The...
-
Rewrite the approximate factorization method of Section 9.3 .3 for the case of three-dimensional heat conduction equation.
-
The two-dimensional heat equation is solved in a rectangular domain \(0
-
Show that the ADI scheme for two-dimensional heat equation can be obtained from the Crank-Nicolson scheme ( 9.35 ) by approximate factorization and that the factorization error is \(O\left((\Delta...
Study smarter with the SolutionInn App