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

Question #280230

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-100 Excellent


80-89 Good


75-79 Fair


50-74 Poor


Other grades Out-of-range

1
Expert's answer
2021-12-16T18:19:53-0500
package com.task;

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        System.out.println("Enter marks: ");
        Scanner in = new Scanner(System.in);
        Integer marks = Integer.valueOf(in.nextLine());

        String range = "Out of range";
        if (marks <= 100 && marks >= 90) {
            range = "Excellent";
        } else if (marks <= 89 && marks >= 80) {
            range = "Good";
        } else if (marks <= 79 && marks >= 75) {
            range = "Fair";
        } else if (marks <= 74 && marks >= 50) {
            range = "Poor";
        }

        System.out.println(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