【文件属性】:
文件名称:daofactory
文件大小:526B
文件格式:JAVA
更新时间:2018-01-13 04:36:05
daofactory
资源共享public class StudentOperate implements PersonOperate{
private PersonDAO dao = null;
private InputData input = null;
public StudentOperate() {
this.dao = DAOFactory.getPersonDAOInstance("student.ser");
this.input = new InputData();
}
public void add() {
String id = new Timestamp("s").getTimestamp();
System.out.print("输入学生姓名:");
String name = this.input.getString();
System.out.print("输入学生年龄:");
int age = this.input.getInt();
System.out.print("输入学生成绩:");
float score = this.input.getFloat();
Student s = new Student(id, name, age, score);
try {
this.dao.doCreate(s);
} catch (Exception e) {
e.printStackTrace();
}
}