So i have a problem that reads: Each line of the file consists of a student’s name followed by an unpredictable number of test
scores. The number of students is also unpredictable. The desired output is as shown where the
numbers there represent the average test score rounded to the nearest whole number.
Create a class called StudentAverages that will input the text file and produce
the indicated output.
i attached the file that i have to read from.
My code so far is:

import java.util.*; 
public class fdhg

public static void main(String args[]) throws IOException
        Scanner sf = new Scanner(new File("Grades.txt"));
        int maxIndx = -1; 
        String text[] = new String[1000]; 


        String answer="";
        int sum=0;
        double average=0;
        int n=0;
        String a="";
        for(int j=0;j<=maxIndx; j++)
            Scanner sc=new Scanner(text[j]);

            String s="";

                int i=sc.nextInt();





So i know how to get the averages if there were just numbers in the file but there is a name at the beginning. How do i print out their name with out having any idea what the contents of the file are. thanks for any help you can offer.

Reading the file with a Scanner is a good start. Now consider the format of you data: you have character strings separated by spaces. This means you could use the .split() method on spaces (" ") to break up your unknown number of scores into a String[]. Remember that the name will always be in index 0, so it will be easy to print. You then simply need to find the average of the rest of the entries in the array. You may need to use the Integer class' parseInt() method as these numbers will be encoded as strings.

Good luck!

ok thanks. regarding the not sure where i should put it or how to how to split the line then convert them back into integers.