Arrays and Objects Creation Problem
I'm trying to get this project to work, that records inputed student's names, grades and ID numbers in an array, the have various functions that search for them. Here is the relevant code (the whole class is over 120 lines long):
Scanner in =new Scanner(System.in);
System.out.println("Welcome to the grades program!");
System.out.println("How many students would you like to store grades for?");
int people = in.nextInt();
Student [] students =new Student [people];
for(int i = 0; i < people; i++)
{
in.nextLine();
System.out.println("What is the name of student #" + (i + 1) +" ?");
String studentName = in.nextLine();
System.out.println("What is " + studentName +"'s grade?");
double studentGrade = in.nextDouble();
students [i] =new Student(studentName, studentGrade, (i + 1));
}
for(int i = 0; i < people; i++)
{
System.out.println(students [i]);
}
While student takes in the name, grade, and ID number in its constructor, and has get and set methods for each of the variables, as well as a unique toString() method.
When I go through the printing loop, it only prints the last student enter, so output looks like this:
http://img201.imageshack.us/img201/7197/picture1ev7.png
There is no complier errors.
Any help?

