This is a Java Program to Read a Grade & Display the Equivalent Description.
Enter the grade of student as input. After that we match the character grade of student against the given cases using equal to operator (==) and hence generate the desired output.
Here is the source code of the Java Program to Read a Grade & Display the Equivalent Description. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class Grade_Description
{
public static void main(String[] args) throws IOException
{
char a;
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
System.out.print("Enter grade of the student:");
a = (char) bf.read();
if(a == 'A' || a == 'a')
{
System.out.println("Student has got marks between above 80 out of 100.");
}
else if(a == 'B' || a == 'b')
{
System.out.println("Student has got marks above 60 but less than equal to 80 out of 100.");
}
else if(a == 'C' || a == 'c')
{
System.out.println("Student has got marks above 40 but less than equal to 60 out of 100.");
}
else
{
System.out.println("Student has failed");
}
}
}
Output:
$ javac Grade_Description.java $ java Grade_Description Enter grade of the student:B Student has got marks above 60 but less than equal to 80 out of 100.
Sanfoundry Global Education & Learning Series – 1000 Java Programs.
advertisement
advertisement
Here’s the list of Best Books in Java Programming, Data Structures and Algorithms.
Related Posts:
- Practice BCA MCQs
- Practice Programming MCQs
- Apply for Java Internship
- Practice Information Technology MCQs
- Check Programming Books