Advertisement
CR7CR7

Grades

Oct 10th, 2022
770
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.72 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class P02Grades {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.  
  7.         double gradeInput = Double.parseDouble(scanner.nextLine());
  8.  
  9.         printGradeInWord(gradeInput);
  10.     }
  11.  
  12.     public static void printGradeInWord(double grade) {
  13.         if (grade >= 2 && grade <= 2.99) {
  14.             System.out.println("Fail");
  15.         } else if (grade <= 3.49) {
  16.             System.out.println("Poor");
  17.         } else if (grade <= 4.49) {
  18.             System.out.println("Good");
  19.         } else if (grade <= 5.49) {
  20.             System.out.println("Very good");
  21.         } else {
  22.             System.out.println("Excellent");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement