# Answered! Review Exercise 5 from Lab 3. a) Write a method called circleCirc that takes a single double parameter and returns a…

ex3

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.

Solution:

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

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Review Exercise 5 from Lab 3. a) Write a method called circleCirc that takes a single double parameter and returns a…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS \$13/PAGE

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
}
public static double sphereVolume(double radius) { //Fucntion to calculate volume of the sphere
}
public static void main(String[] args) {
Scanner sc = new Scanner(System.in); // Iput fromthe user