import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class StuscManage {
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
Student stu1 = new Student();
Student stu2 = new Student();
Student stu3 = new Student();
Student stu4 = new Student();
Student stu5 = new Student();
ArrayList<Student> al = new ArrayList<Student>();
al.add(stu1); al.add(stu2); al.add(stu3); al.add(stu4);
al.add(stu5);
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String[] st = new String[4];
for(int i = 0;i < 5;i++){
st[i] = br.readLine();
String[] s = splitSt(st[i]);
al.get(i).setName(s[0]);
al.get(i).setMath(Integer.parseInt(s[1]));
al.get(i).setChinese(Integer.parseInt(s[2]));
al.get(i).setEnglish(Integer.parseInt(s[3]));
}
for(Student Student:al){
System.out.println(Student.toString()+"\t"+Student.getSum());
}
}
private static String[] splitSt(String st) {
// TODO Auto-generated method stub
String[] s = st.split(",");
return s;
}
}
|
|