hi,
i have to use the system.in.read method to read a character )grade A, B, etc) and display the corresponding marks range.
I have done the following but i am having 'loss of precision' error.
can someone tell me the correct way of inputting a char by sytem.in.read method and it gets out a char and not an integer.
also would like to know how to get the standinpout package as i can't find it.
import java.io.*;
public class CharacterInputb
{
public static void main(
String[] args) throws IOException
{
System.out.println("Please enter a grade character: A, B, C, or D:");
char grade = System.in.read();
System.out.println ("\t Grade \t Mark Range");
if (grade = A){
System.out.println ("\t A \t 80 - 100");
}else if (grade = B){
System.out.println ("\t B \t 70 - 79");
}else if (grade = C){
System.out.println ("\t C \t 55 -69");
}else if (grade = D){
System.out.println ("\t D \t 45 - 54");
}else {
System.out.println ("Wrong character inputted!!!");
}
}
}