pls help it's a programming question
Attachments:
Answers
Answered by
0
import java.util.Scanner;
public class Program
{
public static void volume(int r, float h){
float volume=(1.0f/3)*(3.14f*r*r*h);
System.out.println("radius of cone: "+r);
System.out.println("height of cone: "+h);
System.out.println("Volume of cone: "+volume);
}
public static void volume(float r, float h){
float volume=(3.14f*r*r*h);
System.out.println("radius of cylinder: "+r);
System.out.println("height of cone: "+h);
System.out.println("Volume of cylinder: "+volume);
}
public static void volume(float r){
float volume=(4.0f/3)*(3.14f*r*r*r);
System.out.println("radius of sphere: "+r);
System.out.println("Volume of sphere: "+volume);
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int a=sc.nextInt();
float b=sc.nextFloat();
float c=sc.nextFloat();
Program.volume(a,b);
Program.volume(b,c);
Program.volume(a);
}
}
output ✅
Attachments:
Similar questions
Social Sciences,
7 months ago
English,
7 months ago
Computer Science,
1 year ago
English,
1 year ago
Computer Science,
1 year ago
English,
1 year ago
Science,
1 year ago