Reference no: EM132200474
Write an inheritance hierarchy of three-dimensional shapes.
First, you should create an abstract class that represents all ThreeDimensionalShapes and has methods for finding the volume and surface area of the shapes.
Then, you should create three subclasses that inherit from the original class : Sphere, Cube, and Tetrahedron.
Each class should have an instance variable representing the dimensions of the shape (for example, the Sphere class should have an instance variable representing its radius), and each class should properly implement the methods to find surface area and volume.
(Assume the Tetrahedron class represents a regular Tetrahedron.)
Test your classes in a program that asks the user which shape they'd like to create, and what dimensions they'd like to give it.
The program should print the surface area and volume of the shape (rounded to two decimal places) before terminating.