You are going to write a DoughnutTower game for a toddler! The aim of the game...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
You are going to write a DoughnutTower game for a toddler! The aim of the game is to stack 5 doughnuts of the same colour (red/blue/green). The purpose of this DoughnutTower game assignment is to: Use the provided MyArrayList class and add a method. Write a StackAsMyArrayclass with the typical methods and two additional methods. Write an implementation (test) class for the game. In order to check if a toddler has stacked the 5 doughnuts successfully, one needs to check if all the doughnuts in the tower are the same colour. • Find attached the MyArrayList class. Make the following addition in the MyArrayList class (Please use the given naming conventions): A generic version of this method: public boolean checkUniform() The method should return true if all the doughnuts are identical. • Make sure you have an accessor for the instance variable called: public int getSize() • Write the StackAsMyArrayList class with: • Push(), Pop(), toString() We are going to add 2 non-typical stack methods (just to make this game work) public int getStackSize() which calls the getSize() method of the MyArrayList class • public boolean checkStackUniform() which calls the checkUniform() method of the MyArrayList class HINT: The toString() of the stack class calls the toString() of the MyArrayList class • Write an implementation (test) class for the game. You can use the accompanying output as a guideline. The tower:[] Size:0 The tower is not full DDD The tower: [r, r, r, b, b] Size:5 Correct? false The tower: [r, r, r]. Size:3 The tower is not full The tower: [r, r, r, r, r] Size:5 Correct? true You are going to write a DoughnutTower game for a toddler! The aim of the game is to stack 5 doughnuts of the same colour (red/blue/green). The purpose of this DoughnutTower game assignment is to: Use the provided MyArrayList class and add a method. Write a StackAsMyArrayclass with the typical methods and two additional methods. Write an implementation (test) class for the game. In order to check if a toddler has stacked the 5 doughnuts successfully, one needs to check if all the doughnuts in the tower are the same colour. • Find attached the MyArrayList class. Make the following addition in the MyArrayList class (Please use the given naming conventions): A generic version of this method: public boolean checkUniform() The method should return true if all the doughnuts are identical. • Make sure you have an accessor for the instance variable called: public int getSize() • Write the StackAsMyArrayList class with: • Push(), Pop(), toString() We are going to add 2 non-typical stack methods (just to make this game work) public int getStackSize() which calls the getSize() method of the MyArrayList class • public boolean checkStackUniform() which calls the checkUniform() method of the MyArrayList class HINT: The toString() of the stack class calls the toString() of the MyArrayList class • Write an implementation (test) class for the game. You can use the accompanying output as a guideline. The tower:[] Size:0 The tower is not full DDD The tower: [r, r, r, b, b] Size:5 Correct? false The tower: [r, r, r]. Size:3 The tower is not full The tower: [r, r, r, r, r] Size:5 Correct? true
Expert Answer:
Answer rating: 100% (QA)
Code public class MyArray private Doughnut doughnuts Assuming Doughnut is a class representing ... View the full answer
Related Book For
Accounting Information Systems
ISBN: 978-1260153156
2nd edition
Authors: Vernon Richardson, Chengyee Chang, Rod Smith
Posted Date:
Students also viewed these programming questions
-
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...
-
Design a Java class that represents a cache with a fixed size. It should support operations like add, retrieve, and remove, and it should evict the least recently used item when it reaches capacity.
-
In Exercises 13 through 24, compute the derivative of the given function and find the equation of the line that is tangent to its graph for the specified value x = c. f(x) = -2 X ; c = - 1
-
As the pitch of sound gets higher, what happens to the frequency?
-
At the end of each of the next 40 years, Im going to put $20,000 in my retirement fund. What rate of return on my investments do I need so that I will have $2 million available for retirement in 40...
-
Plaintiffs purchased stock warrants (rights to purchase) for blocks of Osborne Computer Corp., the manufacturer of the first mass-market portable personal computer. Because of inability to produce a...
-
The comparative balance sheet of Charles Inc. for December 31, 2014 and 2013, is as follows: Additional data obtained from an examination of the accounts in the ledger for 2014 are as follows: a. The...
-
-> Let G and H be groups. A function : G H is called a (group) homomorphism if it satisfies (9192) = (91) * (92) for all 91, 92 G. (Note that the product 91*92 uses the group law in the group G,...
-
A heat engine running backward is called a refrigerator if its purpose is to extract heat from a cold reservoir. The same engine running backward is called a heat pump if its purpose is to exhaust...
-
Some believe that International Financial Reporting Standards (IFRS) provide too many choices within its accounting guidance. Is this a possible concern in the area of cash flow reporting in your...
-
Suppose the Modigliani-Miller assumptions hold, and we have no taxes. Cantrasus Inc. currently has no debt. The market value of its equity is $10,000,000. The beta of the equity is 1.5. Cantrasus...
-
why is understanding population growth contributing to climate change important? What can be done to resolve this issue if we understand the relationship?
-
Problem 5 [40 pts]: In this problem, there is a knowledge base KB: as well as a query Q: KB = (a b)^ (a>c) Q=(c b) Use three different techniques show that this claim C (propositional logic sentence)...
-
You are analyzing the cost of debt for a firm. You know that the firms 14-year maturity, 7.0 percent coupon bonds are selling at a price of $856.71. The bonds pay interest semiannually. If these...
-
Shelton Co. purchased a parcel of land six years ago for $872,500. At that time, the firm invested $144,000 in grading the site so that it would be usable. Since the firm wasn't ready to use the site...
-
Cameron is a shareholder in a calendar-year S corporation. On January 1, 2020, Camerons stock basis is $30,000, his share of the accumulated adjustments account (AAA) is $8,000, and his share of...
-
You work as an operations consultant for a textile company. Your client has a well-established distribution system in the US market. The company has hundreds of stores and four distribution centers....
-
Open the Tableau Workbook you created in Problem 10 and updated in Problem 11. 1. Create a vertical bar chart to show total sales (the field calculated in Problem 11) for each store. (Drag the Amount...
-
Information systems have impact on financial results. Using Figure 1-8 as a guide, which system is most likely to impact the following line items on an income statement. The systems to consider are...
-
When would an auditor prefer to conduct a black-box audit? A white-box audit?
-
This question is an extension of Exercise 10.22. Consider the data file \(m r o z\) on working wives and the model \(\ln (W A G E)=\beta_{1}+\beta_{2} E D U C+\beta_{3} E X P E R+e\). Use the 428...
-
Consider the data file \(m r o z\) on working wives. Use the 428 observations on married women who participate in the labor force. In this exercise, we examine the effectiveness of alternative...
-
To examine the quantity theory of money, Brumm (2005) ["Money Growth, Output Growth, and Inflation: A Reexamination of the Modern Quantity Theory's Linchpin Prediction," Southern Economic Journal,...
Study smarter with the SolutionInn App