满意答案
Zc0c1
2013.11.13
采纳率:46% 等级:12
已帮助:7360人
//这个方法,完全可以完成你的要求,希望你可以理解哦!!加油,祝你学习进步~~~
class Box {
double width;
double height;
double depth;
public Box() { // 无参构造方法
width = 1.0;
height = 1.0;
depth = 1.0;
}
public Box(double w, double h, double d) { // 有参构造方法
width = w;
height = h;
depth = d;
}
void getBox() { // 获得盒子信息
System.out.println("The width of Box is :" + width);
System.out.println("the heigth of Box is :" + height);
System.out.println("The depth of Box is :" + depth);
}
void volume() { // 计算体积函数
System.out.pr