代码结构:
相关源码:
武器类:
属性:武器,攻击力,子弹数量。
方法:给属性赋值(set属性()方法)
获取属性值(get属性()方法)
package 红警大战简单版;public class Gun {//武器类private String name;//武器的名字private int attack;//攻击力private int num;//子弹数量public Gun(String name,int attack,int num) {super();this.name = name;this.attack = attack;this.num = num;}public void setName(String name) {this.name = name; }public String getName() {return name;}public void setAttack(int attack) {this.attack = attack;}public int getAttack() {return attack;}public void setNum(int num) {this.num