计算体积

所属分类:Windows编程
开发工具:Java
文件大小:4KB
下载次数:0
上传日期:2019-12-08 16:53:01
上 传 者洛天依00
说明:  编程创建一个Box类(长方体),在Box类中定义三个变量,分别表示长方体的长(length)、宽(width)和高(heigth),再定义一个方法void setBox(int l, int w, int h) 对这三个变量进行初始化,然后定义一个方法int volume ()来计算长方体的体积。最后,在main()方法中创建一个Box类的对象b,首先通过调用对象b的setBox()方法来设置长方体的长、宽和高,再通过调用对象b的volume()方法来计算这个给定尺寸的长方体的体积,并输出这个结果。?
(Program to create a box class (box), define three variables in the box class to represent the length, width and height of the box, define a method void setbox (Int l, int w, int h) to initialize these three variables, and then define a method int volume() to calculate the volume of the box. Finally, create a box class object B in the main() method. First, set the length, width and height of the box by calling the setbox() method of the object B, and then calculate the volume of the box of the given size by calling the volume() method of the object B, and output the result.)

文件列表:
实验1 (0, 2019-11-30)
实验1\.classpath (301, 2019-11-30)
实验1\.project (383, 2019-11-30)
实验1\.settings (0, 2019-11-30)
实验1\.settings\org.eclipse.core.resources.prefs (85, 2019-11-30)
实验1\.settings\org.eclipse.jdt.core.prefs (598, 2019-11-30)
实验1\bin (0, 2019-12-08)
实验1\bin\实验1 (0, 2019-12-08)
实验1\bin\实验1\Box.class (568, 2019-12-08)
实验1\bin\实验1\实验1.class (1227, 2019-12-08)
实验1\src (0, 2019-11-30)
实验1\src\实验1 (0, 2019-12-04)
实验1\src\实验1\实验1.java (637, 2019-11-30)

近期下载者

相关文件


收藏者