> 数学 >
1、设计一个立方体类Box,它能计算并输出立方体的体积和表面积. 提示:定义一个Box类,包含3个数据成员
人气:405 ℃ 时间:2020-08-30 15:53:05
解答
class Box
{
double lenth = 0;
double height = 0;
double width = 0;
public double volume()
{
return lenth * height * width;
}
public double surfaceArea()
{
return 2*(lenth * width + lenth * height + height * width);
}
}
推荐
猜你喜欢
© 2026 79432.Com All Rights Reserved.
电脑版|手机版