Menu

[solved]-Assume Following Subprogram Compute Volume Sphere Please Use Java 1 Public Class Sphere 2 Q39065201

Assume the following subprogram compute the volume of asphere—Please use java

1    public class sphere {
2    public static void main(String[] args) {
3    double R =5.0;// radius
4    double PI=3.14159;  //π

5   doublevolume=(4.0/3.0)*PI*R*R*R;
6    System.out.println(“Volume of a sphere ofradius 5 is: ” + volume);
        }
}

Write the code to move the lines 4 and 5 to a method name itvolume (double r) and return to main program the double type resultof volume of a sphere

Expert Answer


Answer to Assume the following subprogram compute the volume of a sphere—Please use java 1 public class sphere { 2 public static… . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *