import java.io.*;
class std {
  int i;
  String n;
  double s;
}
public class CharReadTest {
  public static void main(String[] args) {
    File ifile = new File("c:\\CharScore.txt");
    FileReader f_read = null;
    BufferedReader b_read = null;
    std[] x = new std[20];
    double sum=0; int c=0;
    String line;
    try {
      f_read = new FileReader(ifile);
      b_read = new BufferedReader(f_read);
      System.out.println("Read Data from File : \n" + ifile);
      System.out.println("===========================");
      while ((line = b_read.readLine()) != null) {        
        x[c] = new std();
        String msg[] = line.split("\t",3);
        x[c].i = Integer.parseInt(msg[0]);
        x[c].n = msg[1];
        x[c].s = Double.parseDouble(msg[2]);
        sum = sum+x[c].s;
        c++;        
      }     
    }
    catch (IOException e){
      System.out.println(e);
    }
    finally {
      try {
        if (b_read != null)
          b_read.close();
        double avg =sum/c;
        for (int i=0;i<c;i++)
          System.out.printf("%-3d%-10s%-6.2f\n",x[i].i,x[i].n,x[i].s);
        System.out.println("===========================");
        System.out.printf("mean = %.2f\n",avg);
        System.out.println("===========================");
      }
      catch (IOException e){
        System.out.println(e);
      }
    }
  }
}