import java.util.Scanner; // Add the import statement for a Scanner
/* This program calculates the volume of a sphere. The user inputs
the radius of the sphere, and the program tells the user the volume.
Bertrise Malone 09/30/22
Here is a sample run:
Enter the radius of the sphere (from the center to the surface): 10
The radius of a sphere with radius 10.00 is 4188.79
*/
public class Lab8 {
public static final Scanner console = new Scanner(System.in); // Declare and instantiate console as a Scanner for keyboard input.
public static void main(String[] args) {
int radius = ” “;
double volume = ” “;// Declare and initialize variables for the radius and the volume.
System.out.print(“Enter the radius of the sphere (from the center to the surface): “);// Prompt the user for the radius of the sphere, as
// “Enter the radius of the sphere (from the center to the surface): ”
radius = console.next(); // Input the radius
// Calculate the volume of the sphere, using the formula (4/3) * PI * radius cubed,
// and assign it to the volume variable.
// Use PI from the Math package and use pow(n,e) from the Math package for the
// cube of the radius.
// Make sure that 4/3 is NOT calculated with integer division
// Output “The radius of a sphere with radius ____ is ____.”, filling in the blanks with
// the radius and the volume, both rounded to the nearest hundredth.
// You may either multiply by 100, use the round method of the Math class to round it off,
// then divide by 100 (avoiding integer division),
// OR you may use the System.out.printf method or you may use the String.format method.
}
}