i have program that i want to output a list from text files then do a sum and output the result

Java Code:
     Scanner cc = new Scanner( new File("CC.txt") );
          Scanner sn = new Scanner( new File("sn.txt") );
          Scanner ng = new Scanner( new File("gn.txt") );
         
          String line ;
          String line2 ;
          String line3 ;
          System.out.println("course code"+" " + "Student Number" +" "+"Number of guests");
         
          int lineCount = 0;  
        BufferedReader br2 = new BufferedReader(new FileReader("gn.txt"));  
 while ((line = br2.readLine()) != null) {  
 lineCount++;  
 
 } 
 double guestNumbers[] = new double[lineCount];
    
       String e1;
       double e;
      for(int i=0; ng.hasNext();i++){
         e1=ng.next();
         e=Double.parseDouble(e1);
         guestNumbers[i]=e;
       }

       
       double total =0;
       

     
          while(  ng.hasNext() ){
            line = cc.nextLine();
            line2 = sn.nextLine();
            line3 = ng.nextLine();
            
            
            int i4=Integer.parseInt(line);
            int i2=Integer.parseInt(line2);
           double i3=Double.parseDouble(line3);
           
            System.out.println(i4 + "         " + i2 + "         " + i3);
         
    
         }
       
  
 

      
         cc.close();
        sn.close();
        ng.close();

           System.out.println("total number of students attending= " + lineCount);
          System.out.println("total number of guests attending = " + summ(guestNumbers));
           System.out.println("the ratio of students to guests is = " + summ(guestNumbers)/lineCount + " to 1");

the output is

course code Student Number Number of guests
total number of students attending= 4
total number of guests attending = 7.0
the ratio of students to guests is = 1.75 to 1

what i want is

course code Student Number Number of guests
321 123321 1.0
321 654123 2.0
111 652145 3.0
324 545545 1.0
total number of students attending= 4
total number of guests attending = 7.0
the ratio of students to guests is = 1.75 to 1