Question: 1 . Declare the headers ( class declaration ) for the classes in the class diagram. 2 . Declare no - argument constructors for Shape,
Declare the headersclass declaration for the classes in the class diagram.
Declare noargument constructors for Shape, TwoDimensionalShape, and
ThreeDimensionalShape classes.
Declare the instance variables for Circleradius Squareside Sphereradius and
Cubeside classes. Declare oneargument and noargument constructors for Circle, Square, Sphere,
and Cube classes.
Declare get and set methods for instance variables in Circle, Square, Sphere, and
Cube classes
Declare computeArea method for Circle, Square, Sphere, and Cube classes.
Declare toString methods for all the classes. Class Shapes toString method should
return the string Shape The toString method of each of the subclasses in the
hierarchy should return a string containing the classs name the string is a and the
result of a call the superclasss toString method.
Write a separate driver classapplication class that creates one object of each of
the classes Circle, Square Sphere and Cube, and invokes their toString methods.
The output for each object should show the isa relationships between that objects
class and its superclasses.Sample Output:
Circle: Circle is a TwoDimesnionalShape is a Shape
Circle's area is
Square: Square is a TwoDimesnionalShape is a Shape
Square's area is
Sphere: Sphere is a ThreeDimesnionalShape is a Shape
Sphere's area is
Sphere's volume is
Cube: Cube is a ThreeDimesnionalShape is a Shape
Cube's area is
Cube's volume is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
