Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Java please. Option #1: Creating an Abstract Class Shape I Create an abstract class Shape with the following specifications: An abstract method surface_area () of

Java please.

Option #1: Creating an Abstract Class Shape I

Create an abstract class "Shape" with the following specifications:

An abstract method "surface_area ()" of return type double

An abstract method "volume()" of return type double

Put your code in a Java source file named "Shape.java."

I.

Create a class "Sphere" that extends the Shape class with the following specifications:

Attributes:

Radius

Constructor:

Implement a parameterized constructor needed to initialize the data.

toString:

Implement a "toString" method that prints out the surface area and volume.

Implement methods to compute the surface area and volume.

II.

Create a class "Cylinder" that extends the Shape class with the following specifications:

Attributes:

Radius, height - both of type double

Constructor:

Implement a parameterized constructor to initialize the data.

toString:

Implement a "toString" method that prints out the surface area and volume.

Implement methods to compute the surface area and volume.

III.

Create a class "Cone" that extends the Shape class with the following specifications:

Attributes:

Radius, height - both of type double

Constructor:

Implement a parameterized constructor to initialize the data.

toString:

Implement a "toString" method that prints out the surface area and volume.

Implement methods to compute the surface area and volume.

IV.

Create a driver class named "ShapeArray" with the following specifications:

Instantiate one sphere.

Instantiate one cylinder.

Instantiate one cone.

Store the class instances into an array named "shapeArray."

Loop through the array and print out the instance data of each object using the object instance's "toString" method.

Show a Unified Modeling Language (UML) diagram of your project.

Condense your source files and UML diagram as a zipped folder and submit the zipped file as your critical thinking assignment (CTA).

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

How Do I Use A Database Research Tools You Can Use

Authors: Laura La Bella

1st Edition

1622753763, 978-1622753765

More Books

Students also viewed these Databases questions

Question

5-8 What are the advantages and disadvantages of cloud computing?

Answered: 1 week ago