Review Exercise 5 from Lab 3. a) Write a method called circleCirc that takes a single double parameter and returns a double value that is equal to the circumference of a circle. The method should calculate the circumference using the absolute value double as the radius. b) Write a method called circleArea that takes one double parameter and returns a double value that is equal to area of a circle. The method should calculate the area using the absolute value of the double parameter as the circles radius. c) Write a method called sphereVolume that takes one double parameter and returns a double value that is equal to volume of a sphere. The method should calculate the volume using the absolute value of the double parameter the spheres radius. d) Write a main method that prints to output an appropriate prompt to the user, then uses the Scanner class to collect the radius of a circle. Print out both the circumference and area of the circle, using a nicely formatted message that also includes the original radius value, followed by the volume of a sphere having the same radius.

## Expert Answer

**Solution:**

/* package whatever; // don’t place package name! */

import java.util.*;

import java.lang.*;

import java.io.*;

/* Name of the class has to be “Main” only if the class is public. */

import java.util.Scanner;

import java.lang.Math;

class Ideone {

public static double circleCir(double radius) { //Fucntion to calculate circumference of the circle

return 2 * Math.PI * radius;

}

public static double circleArea(double radius) { //Fucntion to calculate area of the circle

return Math.PI * radius * radius;

}

public static double sphereVolume(double radius) { //Fucntion to calculate volume of the sphere

return (4/3) * Math.PI * radius * radius * radius;

}

public static void main(String[] args) {

System.out.println(“Please enter the radius of the circle: “);

Scanner sc = new Scanner(System.in); // Iput fromthe user

double radius = sc.nextDouble();

System.out.println(“The radius of the circle is: ” + radius);

System.out.println(“The Circumference of the circle is calculated as: “);

System.out.println(circleCir(radius));

System.out.println(“The area of the circle is calculated as: “);

System.out.println(circleArea(radius));

System.out.println(“The volume of the sphere is calculated as: “);

System.out.println(sphereVolume(radius));

sc.close();

}

}

**Output:**