Question: Open a new project in Netbeans and call it Sphere. Write a complete Java program that takes the radius of a sphere as an input

Open a new project in Netbeans and call it Sphere. Write a complete Java program that takes the radius of a sphere as an input from the user and calculates its volume using the formula:

Volume = (4/3) x PI x (Radius)3

Your program should contain the following parts:

1. A class Sphere that contains a Constructor, Set, Get, and sphereVolume methods

2. Correct use of the static Math class and methods

3. A main function that prompts the user for a positive number and displays the sphere's volume with 2 digits precision. Perform validity checking for the input radius.

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!