Why Choose Us?
0% AI Guarantee
Human-written only.
24/7 Support
Anytime, anywhere.
Plagiarism Free
100% Original.
Expert Tutors
Masters & PhDs.
100% Confidential
Your privacy matters.
On-Time Delivery
Never miss a deadline.
Class Hierarchy (THINK: which classes should be concrete and which should be abstract/interface?) 1
Class Hierarchy (THINK: which classes should be concrete and which should be abstract/interface?)
1. Shape (this is the top level class in your program)
1.1 TwoDShape
o Circle
o Square
o Rectangle
o Triangle (only right-angle triangles if you’d prefer but you must specify in the
program)
o Parallelogram
1.2 ThreeDShape
o Sphere
o Cylinder
o Cone
o Cube
o Prism
o SquarePyramid
Requirements
Each TwoDShape should contain methods getArea() and getPerimeter() to retrieve the area and the perimeter of a two-dimensional shape. Each ThreeDShape should have methods getArea() and getVolume() to retrieve the surface area and the volume of a three-dimensional shape. (See the class hierarchy diagram above and the formulae for the 3-dimensional shapes below)
Note: You should consider having a main() in each class and to test the methods in each class independently to make sure the class works as intended (just like Assignment 2). Then you should make the main() in the driver class to driver the program.
Your program will use a single ArrayList of Shape references to objects of each concrete class in the hierarchy. Make sure to include appropriate constructor(s) and dimensions specific to each class. The program should continually allow the users to do the following until s/he wants to quit.
- add a specific shape to the collection (i.e. the ArrayList): the user should be asked to enter the type of shape and the required dimensions for the specific shape. Then the area and perimeter for 2-dimensional shapes or the surface area and volume for 3-dimensional shapes will be displayed.
- display the information of all the shapes in the collection
- display the information of all the 2-dimentional shapes
- display the information of all the 3-dimensional shapes
- display the information of all of a specific shape, e.g., circles, squares, etc.
Formulae for 3d shapes:
Expert Solution
PFA
Archived Solution
You have full access to this solution. To save a copy with all formatting and attachments, use the button below.
For ready-to-submit work, please order a fresh solution below.





