Advertisement
CoineTre

JF-LabMethods02.Grades

Feb 5th, 2021
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.84 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Lab2Grades {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         double grade = Double.parseDouble(scanner.nextLine());
  7.         printGradeWord(grade);
  8.  
  9.     }
  10.  
  11.     private static void printGradeWord(double gradeWord) {
  12.         String word = "Fail";
  13.         if(3 <= gradeWord && gradeWord <= 3.49){
  14.             word = "Poor";
  15.         }else if (3.5 <= gradeWord && gradeWord <= 4.49){
  16.             word = "Good";
  17.         }else if (4.5 <= gradeWord && gradeWord <= 5.49){
  18.             word = "Very good";
  19.         }else if (5.5 <= gradeWord && gradeWord <= 6.00){
  20.             word = "Excellent";
  21.         }
  22.         System.out.println(word);
  23.     }
  24. }
  25. //Write a method that receives a grade between 2.00 and 6.00 and prints the corresponding grade in words:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement