Use the Program2.java and the Shape.java files attached to implement the Shape hierarchy shown in the diagram
Question:
Use the Program2.java and the Shape.java files attached to implement the Shape hierarchy shown in the diagram below. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape. Each ThreeDimensionalShape should have methods getArea and getVolume to calculate the surface area and volume, respectively, of the three-dimensional shape. Write a program that uses an array of Shape references to objects of each concrete class in the hierarchy. Write a main test class (provided as Program2.java) that uses an array of Shape references to objects of each concrete class in the hierarchy. This class should print a text description of the object. The class should print a text description of the object to which each array element refers. Also, in the loop that processes all the shapes in the array, determine whether each shape is a TwoDimensionalShape or a ThreeDimensionalShape. If it's a TwoDimension
This hierarchy begins with the superclass, Shape, which is extended by two subclasses, TwoDimensionalShape and ThreeDimensionalShape. In geometry, Shapes are either two dimensional or three dimensional. The third level of this hierarchy contains specific types of two dimensional shapes and three dimensional shapes. You can follow the arrows from the bottom of the diagram to the topmost superclass in this class hierarchy to identify several is-a relationships. For instance, a Triangle is a TwoDimensionalShape and is a Shape, while a Sphere is a ThreeDimensionalShape and is a Shape.
The outcome should be:
Can you provide the two classes TwoDimentional and ThreDimentional to provide the sample outcome.
The two codes provided cannot be altered!
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood