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

ex3
Edit View Insert Format Tools Table Window Help 07Lab Search in Document Insert Design Layout References Mailings Review View Times New Ro... v 11 A. AA As A Al E. A B I U abe X2 x2 A Paragraph Styles Exercise 3. Review Exercise 5 from Lab 3. a) Write a method called girelecigg 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 ea 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. Write a method called he 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. 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. CSCI 1100 Laboratory Report 7, page 4 1583 words Focus

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! */

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
Order Essay

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:

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

Still stressed from student homework?
Get quality assistance from academic writers!