for (Enumeration i = entity.getWeapons(); i.hasMoreElements();) { Mounted mo = (Mounted)i.nextElement();
for(Mounted mo : entity.getWeaponList()) {
    public int resolveVariableCost(Entity entity) {        int cost=0;        if(this instanceof MiscType) {            if(this.hasFlag(MiscType.F_MASC)) {                if (hasSubType(MiscType.S_SUPERCHARGER)) {                    Engine e = entity.getEngine();                    if(e == null) cost = 0;                    cost = e.getRating() * 10000;                } else {                    int mascTonnage=0;                    if (this.getInternalName().equals("ISMASC")) {                        mascTonnage = Math.round(entity.getWeight() / 20.0f);                    } else if (this.getInternalName().equals("CLMASC")) {                        mascTonnage = Math.round(entity.getWeight() / 25.0f);                    }                    cost=entity.getEngine().getRating() * mascTonnage * 1000;                }            } else if(this.hasFlag(MiscType.F_TARGCOMP)) {                int tCompTons=0;                float fTons = 0.0f;                for (Enumeration i = entity.getWeapons(); i.hasMoreElements();)                {                    Mounted mo = (Mounted)i.nextElement();                    WeaponType wt = (WeaponType)mo.getType();                    if (wt.hasFlag(WeaponType.F_DIRECT_FIRE))                    fTons += wt.getTonnage(entity);                }                if (this.getInternalName().equals("ISTargeting Computer")) {                    tCompTons=(int)Math.ceil(fTons / 4.0f);                } else if (this.getInternalName().equals("CLTargeting Computer")) {                    tCompTons=(int)Math.ceil(fTons / 5.0f);                }                cost=tCompTons*10000;            } else if (this.hasFlag(MiscType.F_CLUB)                    && (this.hasSubType(MiscType.S_HATCHET)                    || this.hasSubType(MiscType.S_MACE_THB))) {                int hatchetTons=(int) Math.ceil(entity.getWeight() / 15.0);                cost=hatchetTons*5000;            } else if (this.hasFlag(MiscType.F_CLUB)                    && this.hasSubType(MiscType.S_SWORD)) {                int swordTons=(int) Math.ceil(entity.getWeight() / 15.0);                cost=swordTons*10000;            }        } else {            if(cost==0) {                //if we don't know what it is...                System.out.println("I don't know how much " + this.name + " costs.");            }        }        return cost;    }