构造 计算三个盒子的体积
2014-09-11 16:49
134 查看
public class Box { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub Volume a = new Volume(3,2,1); Volume b = new Volume(4,5,6); Volume c = new Volume(7,8,9); System.out.println(a.vol()); System.out.println(b.vol()); System.out.println(c.vol()); } } class Volume{ double lon; double width; double height; Volume(){ } Volume(double lon,double width,double height){ this.lon=lon; this.width=width; this.height=height; } double vol(){ return lon*width*height; } }
相关文章推荐
- 管理云计算只需要三个盒子
- 编写基于对象的程序,计算三个长方住的表面积和体积
- 定义长方体类,数据成员有长、宽、高,成员函数有带默认形参值的构造函数(默认长宽高分别为2.5、3.4、2)、计算体积函数,分别构造默认对象和长宽高分别为6.25、4.8、5.2的对象,输出各对象的体积
- 管理云计算的三个盒子
- 编写一个计算长方体体积的C#WindowsForm,包含一个类,一个方法,三个属性
- NYOJ242 - 计算球体积
- 088 定积分几何应用之面积、体积、弧长计算方法总结
- HDU 2002 计算球体积 新生水题 注意格式和题意即可
- 【杭电2002】计算球体积
- 杭电oj 2002 计算球的体积
- 随机生成三个数,计算其中素数的和
- HDOJ-2002-计算球体积
- 第三周 项目四 求三个长方柱的体积表面积
- HDU 2002 计算球体积
- 杭电acm2002计算球体积
- 圆的表面积和体积的计算
- 计算球体积
- 【程序2】编写应用程序,创建类的对象,分别设置圆的半径、圆柱体的高,计算并分别显示圆半径、圆面积、圆周长,圆柱体的体积。
- 自定控件时 三个构造方法的调用
- NYOJ计算球体积----四舍五入