jeudi 21 juin 2018

else is not a statement

public void calculate()throws IOException {                       
    if(units<=100) {
        bill=units*2;
    } else if(units>100&&units<=300) {
        bill=200+(units-100)*3;
    } else (units>300) {
       amount=200+600+(units-300)*5;
       surcharge=(2.5/100)*amount;
       bill=amount+surcharge;
    }
    System.out.println("BILL AMOUNT:"+bill);
}

else is not a statement is the error i am getting

Aucun commentaire:

Enregistrer un commentaire