Java Program: Take Input from the Student on the Total Marks and Display the Grade Accordingly
The problem is: Write a Java program to display the grade of a student according to the marks inputted by the student. If the marks are in the 90 to 100 range then the grade is O, if in 80 to 89 then the grade is E, if in 70 to 79 then the grade is A, if in the range of 60 to 69 then B, if in 50 to 59 then the grade is C, if in 40 to 49 then the grade is D, and if less then 40 then Fail.
In this program, we'll use the Scanner class to receive input of the marks from the student user. So, at first, we have to import the Scanner class from the Java Utility package.
The object of the Scanner class is myObj, which will take the inputs. After receiving the value, we have to check with the if-elseif-else ladder to determine the grade value according to the input marks.
We have to check for the range so in the condition section, it's a must-use AND(&&) between two conditions.
Filename: StudentMarks.java
0 Comments