HI,
Below is the code, I wanted in Switch case. It gives error.
Would like to know why the error.
class grade {
public static void main(String[] arguments){
int ggrade=0;
ggrade = Integer.parseInt(arguments[0]);
switch (ggrade){
case (ggrade >= 81 && ggrade <= 100):
System.out.println(" grade A"
break;
case (ggrade >= 61 && ggrade <= 80):
System.out.println(" grade B"
break;
case (ggrade >= 41 && ggrade <= 60):
System.out.println(" grade C"
break;
case (ggrade >= 21 && ggrade <= 40):
System.out.println(" grade D"
break;
case (ggrade >= 1 && ggrade <= 20):
System.out.println(" grade F"
break;
default:
System.out.println(" Not Numeric"
}
}
}
Need help!!!
[sig][/sig]
Below is the code, I wanted in Switch case. It gives error.
Would like to know why the error.
class grade {
public static void main(String[] arguments){
int ggrade=0;
ggrade = Integer.parseInt(arguments[0]);
switch (ggrade){
case (ggrade >= 81 && ggrade <= 100):
System.out.println(" grade A"
break;
case (ggrade >= 61 && ggrade <= 80):
System.out.println(" grade B"
break;
case (ggrade >= 41 && ggrade <= 60):
System.out.println(" grade C"
break;
case (ggrade >= 21 && ggrade <= 40):
System.out.println(" grade D"
break;
case (ggrade >= 1 && ggrade <= 20):
System.out.println(" grade F"
break;
default:
System.out.println(" Not Numeric"
}
}
}
Need help!!!
[sig][/sig]