mardi 5 avril 2016

java error not a statement-elecricity bill

This is my java code

import java.lang.*;
import java.io.*;
class Ele
{
    public static void main(String args[])
    {
        int c=220,total;

        if(c<=50)
        {
            total=c*1.5;
        }
        else if(c<=100)
        {

            total=c*2;
        }    
        else if(c<=200)
        {

            total=c*2.8;
        }
        else(c>300)
        {
            total=c*3;
        }
        System.out.println("Amt="+total);
    }
}

My two errors

Ele.java:20: error: not a statement
else(c>300)
    ^
Ele.java:20: error: ';' expected
else(c>300)

Aucun commentaire:

Enregistrer un commentaire