Hi i am looking for following output.I am just getting 0 for a,b,c,d,f.
total no of grades
Number of A's
Number of B
Numbers of C
Number of D
number of F
import java.util.Scanner;
public class ExamScores
{
public static void main (String[]args)
{
String a;
int count= 0;
int grade=0;
int A=0;
int B=0;
int C=0;
int D=0;
int F=0;
Scanner scan = new Scanner (System.in);
System.out.println("Enter your exam grades");
a=scan.nextLine();
int len=a.length ();
for (int i=0; i< len; i++)
{
if (a.charAt (i) ==' '){
count--;
}else {
count++;
}
}
if (grade > 90 && grade <= 100) {
grade= 'A';
A=A+1;
count++;
} else if (grade > 80 && grade <= 89) {
grade= 'B';
B=B+1;
count++;
} else if (grade > 70 && grade <= 79) {
grade= 'C';
C=C+1;
count++;
} else if (grade > 60 && grade <= 69) {
grade= 'D';
D=D+1;
count++;
} else if (grade> 0 && grade <= 59) {
grade= 'F';
F=F+1;
count++;
}
System.out.println("total no of grades=" + count);
System.out.println("Number of A=" + A);
System.out.println("Number of B=" + B);
System.out.println("Number of C=" + C);
System.out.println("Number of D=" + D);
System.out.println("Number of F=" + F);
}
}