Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started