Hello,
I'm currently stuck on this program and wondering if I can find assistance
This programs should prompt users to
enter number(s) (integer(s)) <enter> multiple scores on the same line
see a grade(s)<enter>
then see a sum of the grades entered (abcdf).It also must use BufferedReader.
I'm not using any IDEs, just Notepad and command prompt.
This is what I have so far.
---------------------------------------------------------------------------
import java.io.*;
public class asg4 {
public static void main(String [] args) {
int integer;
int sumA = 0;
int sumB = 0;
int sumC = 0;
int sumD = 0;
int sumF = 0;
//Prompt user using system.out.println and then create your buffered reader here
System.out.println( "Please enter your score(s)");
BufferedReader br;
br = new BufferedReader( new InputStreamReader( System.in ) );
//String line = br.readline();
input = Integer.parseInt(br.readline());
//pass the buffered reader into a Integer.parseInt method here and call the readline()
if(input==-99) System.exit(1);
while(input != -99){
if(input>=90){
sumA++;
System.out.println(new Integer(input) + " A");
}
else if(input >= 70){
sumB++;
System.out.println(new Integer(input) + " B");
}
else if(input >= 50){
sumC++;
System.out.println(new Integer(input) + " C");
}
else if(input >= 35){
sumD++;
System.out.println(new Integer(input) + " D");
}
else{
sumF++;
System.out.println(new Integer(input) + " F");
}
System.out.println("Please enter your score22");
//put a prompt here here (dont have to re-create a buffered reader, use the one above)
input = Integer.parseInt(br.readline());
//and a integer.parseINT method here and call the readline() method off of it
}
System.out.println("The total number of A's is " + new Integer(sumA ));
System.out.println("The total number of B's is " + new Integer(sumB ));
System.out.println("The total number of C's is " + new Integer(sumC ));
System.out.println("The total number of D's is " + new Integer(sumD ));
System.out.println("The total number of F's is " + new Integer(sumF ));
}
}