P
p.munsu
/* Character input.
a) use System.in.read() method to enter a single character into a
variable and print contents of this
variable
b) Use System.in.read() method to enter grade character and print the
corresponding mark range as per
the following scheme:
Grade Mark range
A 80-100
B 70-79
C 55-69
D 45-54 */
public class p4no5 {
public static void main(String args[]) throws Exception {
char x;
int i = 0;
/*System.out.print("Please type a character: ");
x = (char) System.in.read(); */
System.out.print("Please Enter Grade: ");
i = System.in.read();
//System.out.println(x);
if( i < 45 ) {
System.out.println("F");
} else if( i >= 45 && i <= 54 ) {
System.out.println("D");
} else if( i >= 55 && i <= 69 ) {
System.out.println("C");
} else if( i >= 70 && i <= 79 ) {
System.out.println("B");
} else if( i >= 80 && i <= 100 ) {
System.out.println("A");
}
}
}
a) use System.in.read() method to enter a single character into a
variable and print contents of this
variable
b) Use System.in.read() method to enter grade character and print the
corresponding mark range as per
the following scheme:
Grade Mark range
A 80-100
B 70-79
C 55-69
D 45-54 */
public class p4no5 {
public static void main(String args[]) throws Exception {
char x;
int i = 0;
/*System.out.print("Please type a character: ");
x = (char) System.in.read(); */
System.out.print("Please Enter Grade: ");
i = System.in.read();
//System.out.println(x);
if( i < 45 ) {
System.out.println("F");
} else if( i >= 45 && i <= 54 ) {
System.out.println("D");
} else if( i >= 55 && i <= 69 ) {
System.out.println("C");
} else if( i >= 70 && i <= 79 ) {
System.out.println("B");
} else if( i >= 80 && i <= 100 ) {
System.out.println("A");
}
}
}