public static void main(String[] args) {
		int n = 5;//人数
		Scanner s = new Scanner(System.in);
		String[] num = new String[n];
		String[] name = new String[n];
		float[][] grade = new float[n][3];
		float[] ave = new float[n];
		//输入数据
		for(int i=0; i<n; i++){
			System.out.print("学号:");
			num[i] = s.next();
			System.out.print("姓名:");
			name[i] = s.next();
			for(int j=0; j<3; j++){
				System.out.print("第"+(j+1)+"门课成绩:");
				grade[i][j] = s.nextFloat();
			}
		}
		//处理数据
		for(int i=0; i<n; i++){
			for(int j=0; j<3; j++){
				ave[i] += grade[i][j];
			}
			ave[i] /= 3;
		}
		//写入文件
		try {
			FileWriter fw = new FileWriter(new File("d://stud.txt"));
			BufferedWriter bw  = new BufferedWriter(fw);
			for(int i=0; i<n; i++){
				bw.write("学号:" + num[i] + "  ");
				bw.write("姓名:" + name[i] + "  ");
				bw.write("成绩:{  ");
				for(int j=0; j<3; j++){
					bw.write(grade[i][j] + "  ");
				}
				bw.write("} ");
				bw.write("平均成绩: " + ave[i]);
				bw.newLine();
			}
			bw.close();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}