Solution to Implement the shape hierarchy show in the figure below. Each twoDimensionalShape should contain method getArea … - Sikademy
Author Image

Archangel Macsika

Implement the shape hierarchy show in the figure below. Each twoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape. Each threeDimensionalShape should have methods getArea and getVolume to calculate the surface area and volume, respectively, of the three-dimensional shape. Create a program that uses an array of shape references to objects of each class in the hierarchy. The program should print a text description of the object to which each array element refers. Also, in the loop that processes all the shapes in the array, determine whether each shape is a twoDimensionalShape or a threeDimensionalShape. If it’s a twoDimensionalShape, display its area. If it’s a threeDimensionalShape, display its area and volume.

Hmmm... This is a tough one :(

We need the Motivation and Support! 💪

Our expert tutor in charge of answering this question
needs a cup of coffee to get pumped!

Buy her a cup or more ☕

And unlock the solution to this question.

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-6-sqid-153-qpid-6