import java.util.*;
import java.io.*;
public class Student {
private String[] name = new String[10]; //10個學生
private String[] number = new String[10]; //10個學號
private int score[][] = new int[10][4]; //10個學生,每個學生有4門課程
private int aver[] = new int[10];
public static void main(String[] args)throws IOException{
Scanner scanner = new Scanner(System.in);
Student student = new Student();
File file = new File("d:\\stud1.txt");
FileWriter fw = new FileWriter("d:\\stud.txt"); //保存至stud.txt
BufferedWriter bw = new BufferedWriter(fw);
for(int i = 0; i < 10; i++)
{
System.out.println("請輸入姓名");
student.name[i] = scanner.next();
bw.write(" "+student.name[i]);
System.out.println("請輸入學號");
student.number[i] = scanner.next();
bw.write(" "+student.number[i]);
int sum = 0;
for(int j = 0; j < 4; j++)
{
System.out.println("請輸入成績");
student.score[i][j] = scanner.nextInt();
bw.write( " "+student.score[i][j]);
sum = sum + student.score[i][j];
}
student.aver[i] = sum / 4;
bw.write(student.aver[i]);
bw.newLine();
}
bw.close();
}
} //版權所有