1. Write the following Parent Class (getVolume() and getSurfaceArea() return 0.0): Shape 3D -Color: String +Shape3d(String)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write the following Parent Class (getVolume() and getSurfaceArea() return 0.0): Shape 3D -Color: String +Shape3d(String) +getColor(): String +setColor(String):void +toString():String +getVolume():double +getSurfaceArea(): double 2. Write three classes that inherit from the class Shape3D (Ball, Box and Cone) 3. Add the appropriate attributes to each class and Implement the constructor that calls the super constructor. 4. Override the toString() method of each class 5. Override the getVolume() method to calculate and return the volume of each class. 6. Override the getSurfaceArea() method to calculate and return the surface area of each class 7. Create a Tester class to test what you have done a. Create 6 objects, 2 of type Ball, 2 or type Box, and 2 of type Cone b. Add the 6 objects to an array of Shape3D objects toString() c. Loop through all objects of the array and print all objects using the method, then print the volume and the surface area of each shape method within the same loop. d. Print the object with the biggest volume. e. Print the total surface area for all shapes. 1. Write the following Parent Class (getVolume() and getSurfaceArea() return 0.0): Shape 3D -Color: String +Shape3d(String) +getColor(): String +setColor(String):void +toString():String +getVolume():double +getSurfaceArea(): double 2. Write three classes that inherit from the class Shape3D (Ball, Box and Cone) 3. Add the appropriate attributes to each class and Implement the constructor that calls the super constructor. 4. Override the toString() method of each class 5. Override the getVolume() method to calculate and return the volume of each class. 6. Override the getSurfaceArea() method to calculate and return the surface area of each class 7. Create a Tester class to test what you have done a. Create 6 objects, 2 of type Ball, 2 or type Box, and 2 of type Cone b. Add the 6 objects to an array of Shape3D objects toString() c. Loop through all objects of the array and print all objects using the method, then print the volume and the surface area of each shape method within the same loop. d. Print the object with the biggest volume. e. Print the total surface area for all shapes.
Expert Answer:
Related Book For
Building Java Programs A Back To Basics Approach
ISBN: 9780135471944
5th Edition
Authors: Stuart Reges, Marty Stepp
Posted Date:
Students also viewed these programming questions
-
This assignment reviews object-oriented programming concepts such as classes, methods, constructors, accessor methods, and access modifiers. It makes use of an array of objects as a class data...
-
In this programming assignment you will practice using ArrayLists, Inheritance and Polymorphism. You are to write a game called Magical Creatures War. You will do this by implementing a class called...
-
Imagine that a researcher develops a new cancer drug that shrinks tumors, which she measures using an MRI. The researcher needs to determine if the new drug performs differently from, or the same as,...
-
A wooden block is cut into two pieces, one with three times the mass of the other. A depression is made in both faces of the cut, so the a firecracker can be placed in it with the block reassembled....
-
How would differences in exchange rates between different countries affect a firms decisions concerning the use of flexible-price policies in different foreign markets?
-
What is the default filename that make will process if no other is given?
-
In order to meet holiday demand, Pennys Pie Shop requires a production line that is capable of producing 50 pecan pies per week, while operating only 40 hours per week. There are only 4 steps...
-
Question 17 (1 point) If the credit to record the payment of an account payable is not posted Liabilities will be understated Expenses will be understated Cash will be overstated Which statement is...
-
On July 1, 2016, Hargrove Corporation issued a 2-year note with a face value of $4,000,000 and a fixed interest rate of 9%, payable on a semiannual basis. On January 15, 2017, the company entered...
-
In this assignment, you will write a Python program that asks the user for a list of words, and then prints the shortest word, the longest word, and the average length of the words. Here is a sample...
-
fresh from graduatiing from the university of oklahoma in the spring of 2023, Joana is now considering investing 4,000 a year in Roth 401(l) retirement account she recently opened with Morgan...
-
suppose you work for apple, inc. an American multinational technology company headquartered in Cupertino, California, as a financial analyst. You are provided with informaiton about three different...
-
If Superman travels at half the speed of light, 0.5c, how tall in meters will he be? Report your answer to 2 decimal places. m How much mass in kilograms will he have? Round your answer to the...
-
Lenovo Computers has a debt-to-equity ratio of 3, and they are paying an interest rate of 6%. The tax rate is 15%. The Weighted Average Cost of Capital is 10.8% 1. What is the cost of equity capital...
-
Internalize a situation where you are invited as a guest of honor for a ceremony. Kindly pen one among the three discussed genres of a message. It can be an informative message, Persuasive message or...
-
1) Please solve for the question marks (round to the nearest whole number where applicable): A) B) C) D) E) P.V. ? $235.00 Years Interest Rate Compounding Monthly Semiannual 5 2 $6,250.00 $3,750.00...
-
Let (X. A. p) be a measure space. Show that for any A,B A, we have the equality: (AUB)+(An B) = (A) + (B).
-
Add a new method to the Point class we developed in this chapter: public double distance(Point other) Returns the distance between the current Point object and the given other Point object. The...
-
Write a method in the HashIntSet class called retainAll that accepts another hash set as a parameter and removes all elements from this set that are not contained in the other set. For example, if...
-
What is the difference between implementing an interface and extending a class?
-
To ensure that sufficient cash is available at any point in time to fund the withdrawal of cash by its clients, banks use: a. Current account b. Restricted investment account c. Unrestricted...
-
Profit equalisation reserve (PER) is used for: a. Smoothing the profit earned on the investments b. Minimising the variance in return on investments c. Preserving the capital of investment account...
-
After giving the Mudaribs share, a specific proportion of distributable profits is allocated to which reserve: a. Profit equalisation reserve (PER) b. Investment risk reserve (IRR) c. Both a and b d....
Study smarter with the SolutionInn App