class Hero extends Being { protected int charisma; protected String name; protected Weapon holds; public Hero(int s, int d, int ch, String nm) { super(s,d); charisma=ch; name=nm; holds=null; } public Hero(int s, int d, int ch, String nm, Weapon w) { super(s,d); charisma=ch; name=nm; holds=w; } public String toString() { if(holds==null) return name; else return name+" armed with "+holds; } public int morale() { return (strength+defence+charisma)/3; } public void attack(Being b) { if(holds!=null) b.hit(strength,holds.getPower()); } public void attack(Being b, Weapon w) { b.hit(strength,w.getPower()); } public void pickUp(Weapon w) { holds=w; } }