您好,程序如下,望采纳~
import java.util.*;
class CalculateVolume
{
double length,width,height;
CalculateVolume(double a,double b,double c)
{
length=a;
width=b;
height=c;
}
double getVolume()
{
return length*width*height;
}
}
public class BaiDu
{
public static void main(String[] args)
{
double a,b,c;
System.out.println("请输入长,宽,高:");
Scanner read=new Scanner(System.in);
a=read.nextDouble();
b=read.nextDouble();
c=read.nextDouble();
CalculateVolume test=new CalculateVolume(a,b,c);
System.out.println("体积:"+test.getVolume());
}
}