Question: NEED SOLUTION FAST! WILL GIVE GOOD RATING! THANKS! IN JAVA Write a small program that will calculate the volume of bodies. Write a Class Body.

NEED SOLUTION FAST! WILL GIVE GOOD RATING! THANKS!

IN JAVA

Write a small program that will calculate the volume of bodies.

Write a Class Body. That class should have double attribute volume.

Then write three sub-classes from Body: Sphere, Cylinder, and Cube.

The sub-classes should have the required attributes to calculate the respective areas:

Sphere has a double attribute radius, Cylinder has a double attribute height and radius, and Cube has a double attribute side.

In the main program, ask the user which body they want to calculate:1,2, or 3, for Sphere, Cylinder, and Cube. Based on the input, ask for the attribute required to calculate the volumes.

Once the user has entered the required information, output the volume of the body, and ask the user if they want to calculate another volume.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!