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
-
Explain the concept of a data warehouse and its role in business intelligence. Describe the process of extracting, transforming, and loading (ETL) data from various sources into a data warehouse....
-
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,...
-
Using the web sites such as www.quicken.com, Kiplinger's Personal Finance Magazine at www.kiplinger.com, or Money Magazine at www.money.com, or library resources, obtain information about the tax...
-
When Sandra Costello's father died suddenly, Sandra had just completed the semester in college, so she stepped in to run the family business, Costello's Delivery Service, until it could be sold....
-
What is the free-rider problem? Why does it discourage innovation in environmental protection and the adoption of high environmental standards? Can anything be done to overcome the free-rider problem?
-
Shanahan Corporation produces three types of media: CDs, DVDs, and double-layer DVDs. Shanahan purchases cases for the media from a firm in Mexico and purchases the labels from another supplier in...
-
Developstakeholders' (Patient Experience Manager and Facilities Manaager) communication plan outline for the hospital's covid response. (no more than 500 words) in the form of a Memo. -Propose the...
-
Your company is considering acquiring a private company (New Co., Inc.). The CFO has asked you to review the financial statements, look for key trends, and develop financial/operational questions to...
-
As a Leader how can you improve upon giving effective praise (aka positive feedback) to your employees? What are some things you can do to minimize defensiveness and improve your listening skills?
-
Can anyone help me out with these questions. What is the difference between Dismissal and Redundancy? What is wrongful dismissal? In the Public sector what are the two main reasons for terminating a...
-
Your grandfather is retiring at the end of next year. He would like to ensure that his heirs receive payments of $8,400 a year forever, starting when he retires. If he can earn 7.10 percent annually,...
-
Four capacitors are in combination as shown in the pictured circuit. A battery of AV = 46.0 V supplies a potential difference across the combination of capacitors. C1 = 18.0 pF and C2 = 7.00 pF; the...
-
A star has a momentum of 8 . 6 2 \\ times 1 0 ^ 3 6 kg m / s and a speed of 2 5 5 km / s . What is its mass?
-
Imagine you have studied business and management during your time at college and you have the good fortune of receiving multiple job offers after graduation. Congratulations! You will graduate in the...
-
4. A movie buff records the genre of their 60 most recently watched films. a. Construct an appropriately labeled bar chart for these data. [3] b. What are the least common and the most common genres...
-
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?
-
A sample of convenience is never acceptable. In Exercises 1316, determine whether the statement is true or false. If the statement is false, rewrite it as a true statement.
-
A police department conducted a survey in which police officers interviewed members of their community to ask their opinions on the effectiveness of the police department. The police chief reported...
-
Observational studies are generally more reliable than randomized experiments. In Exercises 1116, determine whether the statement is true or false. If the statement is false, rewrite it as a true...
Study smarter with the SolutionInn App