import java.io.*;
import java.util.Scanner;
public class DataFile
{
public static void main(String[] args) throws IOException
{
Scanner input = null;
try
{
input = new Scanner(new BufferedReader(new FileReader("data.txt")));
String name = input.next();
int [] test = new int [5];
int i, sum=0;
for(i=0; i<5; i++)
{
test[i] = input.nextInt();
sum += test[i];
}
double average;
average = sum / 5.0;
System.out.println(name);
for(int a : test)
System.out.print(a + " ");
System.out.println('\n' + "average = " + average);
}
finally
{
input.close();
}
}
}
data.txt:
Phillip 90 93 89 95 71 Ronald 88 72 76 90 81 Willie 14 42 52 85 41 Tobey 60 85 33 90 60 Sophia 80 66 90 100 63 Erica 53 21 71 70 43 Syntia 70 51 33 90 80 Steve 87 85 91 63 100