fork download
  1. import java.util.Scanner;
  2. class Grade{
  3. public static void main (String[]args){
  4. Scanner reader = new Scanner(System.in);
  5. char grade;
  6. System.out.println("Enter your grade: ");
  7. grade = reader.next().charAt(0);
  8. switch(grade){
  9. case'A':
  10. System.out.println("Excellent");
  11. break;
  12. case'B':
  13. System.out.println("Very Good");
  14. break;
  15. case'C':
  16. System.out.println("Good");
  17. break;
  18. case'D':
  19. System.out.println("Fair");
  20. break;
  21. case'F':
  22. System.out.println("Faild");
  23. break;
  24. default:
  25. System.out.println("Invalid Grade");
  26. }
  27. }
  28. }
Success #stdin #stdout 0.12s 49388KB
stdin
A
stdout
Enter your grade: 
Excellent