Alright, so this is my first time posting something like this so you may have to forgive me on the details.
I am trying to write a program that allows a user to enter a variable number of student names and exam scores and then let them ask about the score of individual students by name.Where They should only be able to put in the names and scores once, but they can ask about as many students as they want until they don't want to ask about any more student's grades.

I have created the two arrays, but i am not sure what to do next..here is what i have so far!

//Array for storing the first names of the Students
student = new String[6];
System.out.println("First Name of Students: ");
for (int i = 0; i < 6; i++) {
System.out.print("student: ");
student[i] = sc.next();
}

Ehm. That won't work. You'll have a bunch of names and a bunch of unrelated scores. I'd implement a class Student that encapsulates the name and score for one student. Then fill a List or Array with these objects.

And please use code tags when posting code.

01-30-2013, 11:02 AM

Tolls

Re: help with Array searching

They look like parallel arrays to me.
But then I would load them as Name/Score, Name/Score.
So one loop rather than two.

Of course if the OP has done classes then a Student class would be the proper way forward.