Question: 1. Consider a three-dimensional (3-D) geometric shape as a concept. Any such 3-D shape will have a volume and surface area, but until you
1. Consider a three-dimensional (3-D) geometric shape as a concept. Any such 3-D shape will have a volume and surface area, but until you know the nature of the shape and its attribute dimensions, these will be abstract in nature. o Design and implement an inheritance hierarchy starting with a 3-D shape, then a set of at least three derived classes that define regular 3-D shapes such as a cube, sphere, cylinder, and so on. Include with your submission a UML class diagram showing the design. o Any general 3-D shape will have a name, but few other attributes. For each derived shape, store fundamental attribute data about its dimensions, and provide methods to access and modify this data. In addition, provide appropriate methods to compute each shape's volume and surface area. For example, a cube has a volume of s3 where s is the length of a side, whereas a sphere has a volume of 4tr/3 where r is the radius. In terms of style, every class should have constructors and a tostring () method that properly uses inheritance. o Create a driver class with an array reference for 3-D shapes, and instantiate several shapes of different types and dimensions to exercise the behaviour you provided.
Step by Step Solution
3.41 Rating (145 Votes )
There are 3 Steps involved in it
Answer Heres the UML class diagram for the design described 3DShape name String 3DShapename String getName String setNamename String computeVolume dou... View full answer
Get step-by-step solutions from verified subject matter experts
