Here is what the data should look like if group "A" has no data in it, and group "B" has four test scores in it:
0 4 78 82 91 84
Here is what the program writes out for this data:
C:\users\default\JavaLessons>java TestGroups File name? student.data Group A has no students Group B average: 83.75
The program will also work correctly if neither group has data. This might seem like a situation that will never occur, but programs should be written with the expectation that defective data (or unlikely data) will occur.
Instead of a header that says how much data is in each group, could each group end with a sentinel value?