Answer:
public static double volCylinder(double r, double h){
double volCylinder = Math.PI*(r*r)*h;
return volCylinder;
}
Explanation:
Using Java programming language
The function (method) is declared to accept two double parameters for radius and height
Using the formula Vol = The volume is calculated and returned.
See a complete java code with a main method below
<em>public class num7 {</em>
<em> public static double volCylinder(double r, double h){</em>
<em> double volCylinder = Math.PI*(r*r)*h;</em>
<em> return volCylinder;</em>
<em />
<em> }</em>
<em> public static void main(String[] args) {</em>
<em> double radius =5.1;</em>
<em> double height = 7.1;</em>
<em> System.out.println("The volume of the cylinder is: "+volCylinder(radius,height));</em>
<em> }</em>
<em>}</em>