for (Enumeration i = getWeapons();i.hasMoreElements();) { Mounted m = (Mounted) i.nextElement();
for (Mounted m : getWeaponList()) {
    public double getCost() {        double cost = 0;        Engine engine = getEngine();        cost += engine.getBaseCost() * engine.getRating() * weight / 75.0;        double controlWeight = Math.ceil(weight*0.05*2.0)/2.0; //? should be rounded up to nearest half-ton        cost += 10000*controlWeight;        cost += weight/10.0*10000; // IS has no variations, no Endo etc.        double freeHeatSinks = engine.getCountEngineHeatSinks();        int sinks=0;        double turretWeight=0;        double paWeight=0;        for (Enumeration i = getWeapons();i.hasMoreElements();) {            Mounted m = (Mounted) i.nextElement();            WeaponType wt = (WeaponType) m.getType();            if(wt.hasFlag(WeaponType.F_LASER) || wt.hasFlag(WeaponType.F_PPC)) {                sinks+=wt.getHeat();                paWeight+=wt.getTonnage(this)/10.0;            }            if(!hasNoTurret() && m.getLocation()==Tank.LOC_TURRET) {                turretWeight+=wt.getTonnage(this)/10.0;            }        }        paWeight=Math.ceil(paWeight*10.0)/10;        if (engine.isFusion()) {            paWeight=0;        }        turretWeight=Math.ceil(turretWeight*2)/2;        cost+=20000*paWeight;        cost+=2000*Math.max(0,sinks-freeHeatSinks);        cost+=turretWeight*5000;        cost+=getArmorWeight()*EquipmentType.getArmorCost(armorType);//armor        double diveTonnage;        switch (movementMode) {            case IEntityMovementMode.HOVER:            case IEntityMovementMode.HYDROFOIL:            case IEntityMovementMode.VTOL:            case IEntityMovementMode.SUBMARINE:                diveTonnage = weight/10.0;                break;            default:                diveTonnage = 0.0;                break;        }        if (movementMode!=IEntityMovementMode.VTOL) {            cost += diveTonnage*20000;        } else {            cost += diveTonnage*40000;        }        cost += getWeaponsAndEquipmentCost();        double multiplier = 1.0;        switch (movementMode) {            case IEntityMovementMode.HOVER:            case IEntityMovementMode.SUBMARINE:                multiplier += weight/50.0;                break;            case IEntityMovementMode.HYDROFOIL:                multiplier += weight/75.0;                break;            case IEntityMovementMode.NAVAL:            case IEntityMovementMode.WHEELED:                multiplier += weight/200.0;                break;            case IEntityMovementMode.TRACKED:                multiplier += weight/100.0;                break;            case IEntityMovementMode.VTOL:                multiplier += weight/30.0;                break;        }         return Math.round(cost*multiplier);    }