Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package methods;
- import java.util.Scanner;
- public class P02Grades {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double inputGrade = Double.parseDouble(scanner.nextLine());
- printGradeWord(inputGrade);
- }
- public static void printGradeWord(double grade) {
- String word = "";
- if (grade >= 2 && grade <= 2.99) {
- word = "Fail";
- } else if (grade >= 3 && grade <= 3.49) {
- word = "Poor";
- } else if (grade >= 3.5 && grade <= 4.49) {
- word = "Good";
- } else if (grade >= 4.5 && grade <= 5.49) {
- word = "Very good";
- } else if (grade >= 5.5) {
- word = "Excellent";
- }
- System.out.println(word);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement