Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA LANGUAGE!! DO NOT COPY OFF OTHER CODES OFF OF CHEGG OR ANOTHER WEBSITES DO YOUR OWN/ EXPLAIN IF POSSIBLE Submit a single zip file
JAVA LANGUAGE!! DO NOT COPY OFF OTHER CODES OFF OF CHEGG OR ANOTHER WEBSITES DO YOUR OWN/ EXPLAIN IF POSSIBLE
Submit a single zip file in Blackboard. Do NOT submit via email. Submit only source code (java file) Put a comment (your name) in the first line of each java file There will be partial credits as long as the grader can input values in a correct format. However, it will be zero if any compilation error or run time error occurs. Do NOT share your code with anyone. If you do, you will get F and be reported. Start today, not tomorrow! Program 1 (70 points) Define a class structure that models a shape hierarchy Shape - base class for any kind of shape, holds an array of vertices PlaneShape- base class for all plane (2D) shapes, holds a array of 2D vertices (holding x and y) implements PerimeterMeasurable and AreaMeasurable interfaces o Triangle- holds 3 vertices Rectangle - holds 1 vertex, width, height Circle-holds 1 vertex and radius " - SpaceShape-base class for all three-dimensional shapes, holds an array of 3D vertices (holding x, y and z), implements AreaMeasurable and VolumeMeasurable interfaces O 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 Submit a single zip file in Blackboard. Do NOT submit via email. Submit only source code (java file) Put a comment (your name) in the first line of each java file There will be partial credits as long as the grader can input values in a correct format. However, it will be zero if any compilation error or run time error occurs. Do NOT share your code with anyone. If you do, you will get F and be reported. Start today, not tomorrow! Program 1 (70 points) Define a class structure that models a shape hierarchy Shape - base class for any kind of shape, holds an array of vertices PlaneShape- base class for all plane (2D) shapes, holds a array of 2D vertices (holding x and y) implements PerimeterMeasurable and AreaMeasurable interfaces o Triangle- holds 3 vertices Rectangle - holds 1 vertex, width, height Circle-holds 1 vertex and radius " - SpaceShape-base class for all three-dimensional shapes, holds an array of 3D vertices (holding x, y and z), implements AreaMeasurable and VolumeMeasurable interfaces O 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 shapeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored 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