//读入圆柱的半径和高并计算体积
import java.util.Scanner;
public class Cylinder {
public static void main(String args[])
{
final double PI=3.14159;
double area;
double volume;
double radius=0.0;
double length = 0;
Scanner sc=new Scanner(System.in);
System.out.print("Enter the radius and length of a cylinder:");
{
radius=sc.nextDouble();
area= PI*radius*radius;
length=sc.nextDouble();
volume=area*length;
}
System.out.println("The area is " +area + " and " + " The volume is " +volume);
}
}
//读入圆柱的半径和高并计算体积
import java.util.Scanner;
public class Cylinder {
public static void main(String args[])
{
final double PI=3.14159;
double area;
double volume;
double radius=0.0;
double length = 0;
Scanner sc=new Scanner(System.in);
System.out.print("Enter the radius and length of a cylinder:");
{
radius=sc.nextDouble();
area= PI*radius*radius;
length=sc.nextDouble();
volume=area*length;
}
System.out.println("The area is " +area);
System.out.println("The volume is " +volume);
}
}