Answer to Question #281160 in Java | JSP | JSF for Bjoy

Question #281160

Create a program that will display the corresponding remark of a given input grade. The range of grades and its corresponding remark are given below:



Note: Use switch case statement



Range of Grades Remarks


90-10 Excellent


80-89 Good


75-7 Fair


50-74 Poor


Other grades Out-of-range











Range of Grades Remarks


90-10 Excellent


80-89 Good


75-7 Fair


50-74. Poor


Other grades Out-of-range

1
Expert's answer
2021-12-20T09:54:57-0500
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Grade:");
        int grade = in.nextInt();
        switch (grade) {
            case 100:
            case 99:
            case 98:
            case 97:
            case 96:
            case 95:
            case 94:
            case 93:
            case 92:
            case 91:
            case 90:
                System.out.println("Excellent");
                break;
            case 89:
            case 88:
            case 87:
            case 86:
            case 85:
            case 84:
            case 83:
            case 82:
            case 81:
            case 80:
                System.out.println("Good");
                break;
            case 79:
            case 78:
            case 77:
            case 76:
            case 75:
                System.out.println("Fair");
                break;
            case 74:
            case 73:
            case 72:
            case 71:
            case 70:
            case 69:
            case 68:
            case 67:
            case 66:
            case 65:
            case 64:
            case 63:
            case 62:
            case 61:
            case 60:
            case 59:
            case 58:
            case 57:
            case 56:
            case 55:
            case 54:
            case 53:
            case 52:
            case 51:
            case 50:
                System.out.println("Poor");
                break;
            default:
                System.out.println("Out-of-range");
        }
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog