Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create a program that calculates the areas and volumes of circle and cylinder using an interface class and inheritance. As shown in the below diagram

Create a program that calculates the areas and volumes of circle and cylinder using an interface class and inheritance. As shown in the below diagram

The shape interface contains three abstract methods as follows: getArea (), getVolume() and getName().

The point class implements the shape interfaces and contains two private integer parameters : x and y with public get and set methods for theses parameters.

The circle class extends the point class with an additional private double parameter named radius. You should add get and set methods and override methods from the superclass i.e. getArea (), GetNames.when it is applicable

The cylinder class extends the circle class with an additional private double parameter named height. You should add public get and set methods and override methods from the superclass i.e. getArea (), getVolume() . when they are needed

In the main class (Test Class). The program should ask the user about how many objects will be created. The type of each object (point, circle, or cylinder). Ask the user to enter the parameters for each object. All objects will be saved in an array list. Using a loop, the program, should print a text description of each object in the array element. Also, you should display the area and volume of each object when applicable.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions

Question

Prepare for a successful job interview.

Answered: 1 week ago