Question: Write an inheritance hierarchy of three-dimensional shapes. Make a top-level shape interface that has methods for getting information such as the volume and surface area
Write an inheritance hierarchy of three-dimensional shapes. Make a top-level shape interface that has methods for getting information such as the volume and surface area of a three-dimensional shape. Then make classes and subclasses that implement various shapes such as cubes, rectangular prisms, spheres, triangular prisms, cones, and cylinders. Place common behavior in superclasses whenever possible, and use abstract classes as appropriate. Add methods to the subclasses to represent the unique behavior of each three-dimensional shape, such as a method to get a sphere’s radius.
Step by Step Solution
3.46 Rating (166 Votes )
There are 3 Steps involved in it
public class CircularCone extends CircularShapeWithHeight public CircularConedouble radius double height superradius height public double getSurfaceAr... View full answer
Get step-by-step solutions from verified subject matter experts
