文件名称:JAVA
介绍说明--下载内容均来自于网络,请自行研究使用
定义长方体类Cuboid,要求如下:(1)私有成员变量包括长length、宽width和高height;(2)构造方法包括一个公共的空构造方法,一个能够初始化所有成员变量的构造方法;(3)包括所有的setter和getter方法,其中setter方法要求对形参进行验证,例如长、宽和高都大于0;(4)功能方法包括计算表面积getArea()、计算体积getCubage()、判断是否正方体isCube()、输出该长方体的长宽高printCuboid()、绘制该长方体(给出提示信息即可)drawing()。
测试一要求如下:(1)利用空构造方法创建一个新的长方体对象cuboidA,然后利用setter方法设置长宽高分别为1.5、2.6和18.6,(2)调用printCuboid()方法输出cuboidA的基本信息,调用isCube()方法判断是否正方体;(3)调用方法drawing()模拟绘制该长方体。
测试二要求如下:(1)利用构造方法创建一个具有长宽高分别为2.5、6.8和8.0的长方体对象cuboidB,然后利用setLength()方法修改length为4.6;(2)调用getArea()方法计算表面积;(3)调用getCubage计算该长方体的体积。(The cuboid class cuboid is defined as follows: (1) the private member variables include length, width and H eight; (2) the construction method includes a public empty construction method, a construction method that can initialize all member variables; (3) all setter and getter methods are included, where the setter method requires to verify the parameters, such as length, width and height are greater than 0 (4) the function methods include calculating the surface area getarea (), calculating the volume getcube (), judging whether the cube is iscube (), outputting the length, width and height printcube (), drawing the box (just give the prompt information) drawing ().)
测试一要求如下:(1)利用空构造方法创建一个新的长方体对象cuboidA,然后利用setter方法设置长宽高分别为1.5、2.6和18.6,(2)调用printCuboid()方法输出cuboidA的基本信息,调用isCube()方法判断是否正方体;(3)调用方法drawing()模拟绘制该长方体。
测试二要求如下:(1)利用构造方法创建一个具有长宽高分别为2.5、6.8和8.0的长方体对象cuboidB,然后利用setLength()方法修改length为4.6;(2)调用getArea()方法计算表面积;(3)调用getCubage计算该长方体的体积。(The cuboid class cuboid is defined as follows: (1) the private member variables include length, width and H eight; (2) the construction method includes a public empty construction method, a construction method that can initialize all member variables; (3) all setter and getter methods are included, where the setter method requires to verify the parameters, such as length, width and height are greater than 0 (4) the function methods include calculating the surface area getarea (), calculating the volume getcube (), judging whether the cube is iscube (), outputting the length, width and height printcube (), drawing the box (just give the prompt information) drawing ().)
相关搜索: 《JAVA面向对象程序设计》实验报告
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
JAVA.doc | 46648 | 2020-04-30 |