文件名称:two
介绍说明--下载内容来自于网络,使用问题请自行百度
写一个类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 |
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.