Thank you this is what i have now. good news is errors are gone..however it is not functioning. I am pretty new to this. this is what i have right now i will try to make it work from information you gave me
public class switches {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int grade = 90;
char gradel = 'X';
if (grade >= 90)
gradel = 'A';
if (grade < 90)
if (grade >= 80)
gradel = 'B';
if (grade < 80)
if (grade >= 70)
gradel = 'C';
if (grade < 70)
gradel = 'F';
switch (gradel){
case 'A':
System.out.println("You got A");
case 'B':
System.out.println("You got B");
case 'C':
System.out.println("You got C");
case 'F':
System.out.println("You got F");
}
}
--- Update ---
This is the one i did using if only.. the only reason i wanted to do switch so i can understand and be able to implent it if i need to.. the if one was very straight forward and worked
public class If {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
int grade = 85;
if (grade > 89){
System.out.println("You got A");
System.out.println("Your grade is " +grade);
}
if (grade < 90){
if (grade >= 80)
System.out.println("You got B");
System.out.println("your grade is " +grade);
}
if (grade < 80)
if (grade >=70){
System.out.println("You got C");
System.out.println("Your grade is " +grade);
}
if (grade < 70){
System.out.println("You got F");
}
}
}