Here is part A of the program that will work with this type of input data file. Of course, there are some blanks for you to fill.
import java.io.*;
import java.util.Scanner;
class TestGroupsSentinel
{
  public static void main ( String[] args ) throws IOException
  {
    int value;     // the value of the current integer
    
    // Prompt for and open the input file   
    Scanner user = new Scanner( System.in );
    System.out.print("File name? ");
    String fileName = user.next().trim();
    Scanner scan = new Scanner( new File(fileName) );  
    // Group "A"
    int sumA = ;      // the sum of scores for group "A"
    int countA = ;    // initialize the group A count
    
    while ( (value = scan.nextInt()) != -1 )
    {
      sumA   = sumA +  ; // add to the sum
      countA = countA + 1;    // increment the count
    }
    if ( countA >  )
      System.out.println( "Group A average: " + ((double) sumA)/countA ); 
    else
      System.out.println( "Group A  has no students" );
        Of course, you are eager to fill in those blanks.