I want to be able to input two (2) 'grades' exactly like they are in the String array and have it come back printing BOTH showing the grades, again, as well as the grade score corresponding to those grades.
For example: input C- (enter) B+ (enter)
output does: ONLY the last input I did (B+) printing....
"The grade is B+ and the score is 87-89"
I want C- to ALSO be printing but it ALWAYS does only the last one I input......help!!!
//Date: 4/10/2010
import java.io.*;
class Grade2
{
public static void main(String[] args) throws IOException
{
String[] grade = {"A","A-","B+","B","B-","C+","C","C-","D+","D","D-","F"};
String[] score = {"94-100","90-93","87-89","84-86","80-83","77-79","74-76","70-73","67-69","64-66","60-63","59"};
BufferedReader dataIn = new BufferedReader(new InputStreamReader(System.in));
String testscore = "";
for (int y = 0; y < 2; ++y)
{
System.out.print("What is the grade?: ");
testscore = dataIn.readLine();
}
for (int x = 0; x < grade.length; ++x)
if (grade[x].equals(testscore))
System.out.println("The grade is " + grade[x] + " and the score is " + score[x]);
}
}