Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Java by Shriyan ( 6 years ago )
import java.util.Scanner;
class Problem7 {
static float findVolume (float r1) {
return (float) (1.0/3.0*3.14*r1*r1);
}
static int findVolume (int r2 , int h) {
return (int) (3.14*r2*r2*h);
}
static int findVolume(int r1 , int r2 , int r3) {
return (int) ( 4/3*3.14*r1*r2*r3);
}
public static void main(String []args) {
System.out.println("Please enter the radius of cone:");
Scanner scanner = new Scanner (System.in);
int r1 = scanner.nextInt();
System.out.println("Please enter the radius of the cylinder");
int r2 = scanner.nextInt ();
System.out.println("Please enter the height of the cylinder");
int h = scanner.nextInt();
System.out.println("Please enter the radius of the sphere");
int r3 = scanner.nextInt();
System.out.println("Volume of cone: " + findVolume((float)r1));
System.out.println("Volume of Cylinder: " + findVolume( r2, h));
System.out.println("Volume of sphere : " + findVolume( r1, r2 , r3));
}
}
Revise this Paste