import java.util.*;
import java.io.*;
public class TreeSetToFile {
public static void main(String[] args)throws IOException {
Scanner sc = new Scanner(System.in);
Set<StudentScore> set = new TreeSet<StudentScore>(new ScoreComparator());
for(int x = 0 ; x < 3 ; x++){
String line = sc.nextLine();
String[] str = line.split(" +");
set.add(new StudentScore(str[0], Integer.parseInt(str[1]),
Integer.parseInt(str[2]), Integer.parseInt(str[3])));
}
BufferedWriter bfw = new BufferedWriter(new FileWriter("c:\\student.txt"));
for(StudentScore s : set){
bfw.write(s.toString());
bfw.flush();
bfw.newLine();
}
bfw.close();
}
}
|
|