Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can I get some help, its suppose to be done in JAVA Define a class structure that models a shape hierarchy. Shape base class for

Can I get some help, its suppose to be done in JAVA

image text in transcribed

Define a class structure that models a shape hierarchy. Shape base class for any kind of shape, holds an array of vertices o PlaneShape base class for all plane (2D) shapes, holds a array of 2D vertices (holding x and y), implements PerimeterMeasurable and AreaMeasurable interfaces Triangle - holds 3 vertices Rectangle-holds 1 vertex, width, height Circle - holds 1 vertex and radius o SpaceShape base class for all three-dimensional shapes, holds an array of 3D vertices (holding x, y and z), implements AreaMeasurable and VolumeMeasurable interfaces Square Pyramid holds 1 vertex (base center), base width, pyramid height Cuboid - holds 1 vertex, width, height, depth Sphere - holds 1 vertex and radius A vertex is a point in 2D/3D space. The distance between two 2D vertices is calculated using the formula: Define the following interfaces: .PerimeterMeasurable - holds double getPerimeter() AreaMeasurable - holds double getArea() VolumeMeasurable - holds double getVolume() Design the class hierarchy using proper inheritance and code reusability through abstraction. Each shape should implement its respective interfaces with proper formulas. Override toString() to return information about each shape (shape type, each vertex's coordinates, perimeter/area/volume). Create objects of different classes and add them to a single array. Iterate through the array and print information about each shape. Define a class structure that models a shape hierarchy. Shape base class for any kind of shape, holds an array of vertices o PlaneShape base class for all plane (2D) shapes, holds a array of 2D vertices (holding x and y), implements PerimeterMeasurable and AreaMeasurable interfaces Triangle - holds 3 vertices Rectangle-holds 1 vertex, width, height Circle - holds 1 vertex and radius o SpaceShape base class for all three-dimensional shapes, holds an array of 3D vertices (holding x, y and z), implements AreaMeasurable and VolumeMeasurable interfaces Square Pyramid holds 1 vertex (base center), base width, pyramid height Cuboid - holds 1 vertex, width, height, depth Sphere - holds 1 vertex and radius A vertex is a point in 2D/3D space. The distance between two 2D vertices is calculated using the formula: Define the following interfaces: .PerimeterMeasurable - holds double getPerimeter() AreaMeasurable - holds double getArea() VolumeMeasurable - holds double getVolume() Design the class hierarchy using proper inheritance and code reusability through abstraction. Each shape should implement its respective interfaces with proper formulas. Override toString() to return information about each shape (shape type, each vertex's coordinates, perimeter/area/volume). Create objects of different classes and add them to a single array. Iterate through the array and print information about each shape

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Concepts of Database Management

Authors: Philip J. Pratt, Mary Z. Last

8th edition

1285427106, 978-1285427102

More Books

Students also viewed these Databases questions