I'm really beginner trying to learn code and based on the literature I read I created the following program. The problem with this code is that any number I enter returns GRADE F. If I remove System.in.read() and set permanent value then it works just fine. Anyone guessing what could be wrong with my code?
class ladder2 {
public static void main(String args[])
throws java.io.IOException {
char read, grade;
// read = 75;
System.out.println("Enter a score between 0 and 100: ");
read = (char) System.in.read();
if (100 <= read) grade = 'A';
else if (85 <= read) grade = 'B';
else if (75 <= read) grade = 'C';
else if (60 <= read) grade = 'D';
else grade = 'F';
System.out.println("GRADE " + grade);
}
}