In: Computer Science
Java Ask the user to input a letter grade in either upper or lower case. You are to output a message depending on the grade. When the input is A or a, output the word "Excellent!" When the input is B or b, output "Very Good" When the input is C or c, output "Satisfactory" For any other input you must output the word "Fail".
HERE IS THE CODE...PLEASE GIVE AN UPVOTE
import java.util.Scanner;
public class Main
{
public static void main(String[] args)
{
System.out.print("enter grade in upper or lower ");
Scanner sc = new Scanner(System.in);
// Character input
char c = sc.next().charAt(0);
if(c== 'A' || c=='a')
{
System.out.println("Excellent");
}
else if(c== 'B' || c=='b')
{
System.out.println("Very Good");
}
else if(c== 'C' || c=='c')
{
System.out.println("Satisfactory");
}
else
{
System.out.println("Fail");
}
}
}
Output