Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Lab2Grades {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- double grade = Double.parseDouble(scanner.nextLine());
- printGradeWord(grade);
- }
- private static void printGradeWord(double gradeWord) {
- String word = "Fail";
- if(3 <= gradeWord && gradeWord <= 3.49){
- word = "Poor";
- }else if (3.5 <= gradeWord && gradeWord <= 4.49){
- word = "Good";
- }else if (4.5 <= gradeWord && gradeWord <= 5.49){
- word = "Very good";
- }else if (5.5 <= gradeWord && gradeWord <= 6.00){
- word = "Excellent";
- }
- System.out.println(word);
- }
- }
- //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