An example of the file would look like so:
2
Joe Shmo
90
85
74
Bob Bobby
67
99
87
The method that creates the null array is so:
public static Student[] createStudentArray(Scanner sc) {
int arraySize = sc.nextInt();
Student[] studentArray = new Student[arraySize];
for(int i = 0; i < studentArray.length; i++){
studentArray[i] = null;
}
return studentArray;
}
A small snippet of the Student object is:
public Student(String firstName, String lastName, double average) {
this.firstName = firstName;
this.lastName = lastName;
this.average = average;
What I have thus far is..
public static void populateStudentArray(Student[] studentArray, Scanner sc) {
Student student = studentArray[0];
for(int i = 0; i < studentArray.length; i++){
}
}
I can't get how to skip the first line, and to read the first and last name in as Strings while calculating the average of their test scores into the array. Any advice would be greatly appreciated.

New Topic/Question
Reply



MultiQuote



|