文件名称:two
- 所属分类:
- JSP源码/Java
- 资源属性:
- 上传时间:
- 2018-04-15
- 文件大小:
- 1kb
- 下载次数:
- 0次
- 提 供 者:
- J***
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
写一个类Army,代表一支军队,这个类有一个属性Weapon数组w(用来存储该军队所拥有的所有武器),该类还提供一个构造方法,在构造方法里通过传一个int类型的参数来限定该类所能拥有的最大武器数量,并用这一大小来初始化数组w。该类还提供一个方法addWeapon(Weapon wa),表示把参数wa所代表的武器加入到数组w中。在这个类中还定义两个方法attackAll()让w数组中的所有武器攻击;以及moveAll()让w数组中的所有可移动的武器移动。
(6)写一个主方法去测试以上程序。(Write a class Army, representing an army, which has an attribute Weapon array w (used to store all the weapons that the army has). This class also provides a construction method that defines the number of maximum weapons that the class can have by passing a int type parameter in the construction method, and initializes the number with this size. Group w. This class also provides a method called addWeapon (Weapon WA), which means the weapon represented by parameter Wa is added to the array w. In this class, we also define two ways, attackAll (), to attack all weapons in W array, and moveAll () to move all mobile weapons in W array.)
(6)写一个主方法去测试以上程序。(Write a class Army, representing an army, which has an attribute Weapon array w (used to store all the weapons that the army has). This class also provides a construction method that defines the number of maximum weapons that the class can have by passing a int type parameter in the construction method, and initializes the number with this size. Group w. This class also provides a method called addWeapon (Weapon WA), which means the weapon represented by parameter Wa is added to the array w. In this class, we also define two ways, attackAll (), to attack all weapons in W array, and moveAll () to move all mobile weapons in W array.)
相关搜索: java编程
(系统自动生成,下载前可以参看下载内容)
下载文件列表
文件名 | 大小 | 更新时间 |
---|---|---|
two.java | 1871 | 2018-04-09 |