基本信息
源码名称:java 学生信息管理系统(基于XML)
源码大小:0.01M
文件格式:.rar
开发语言:Java
更新时间:2019-06-12
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
这是一个基于XML操作的学生信息管理小系统,实现了对学生信息的录入,查找,删除等操作。可以说是一个简易的“数据库”综合小应用!
这是一个基于XML操作的学生信息管理小系统,实现了对学生信息的录入,查找,删除等操作。可以说是一个简易的“数据库”综合小应用!
package view;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import dao.StudentDao;
import domain.Student;
public class Main {
public static void main(String []args) throws Exception{
System.out.println("添加学生(a),查找学生(f),删除学生(d)");
System.out.println("请输入操作类型:");
BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
String type = reader.readLine();
if(type.equalsIgnoreCase("a")){
//add student
//name examid idcard location grade
try{
System.out.println("请输入学生姓名: ");
String name = reader.readLine();
System.out.println("请输入学生准考证号: ");
String examid = reader.readLine();
System.out.println("请输入学生身份证号: ");
String idcard = reader.readLine();
System.out.println("请输入学生所在地: ");
String location = reader.readLine();
System.out.println("请输入学生成绩: ");
String grade = reader.readLine();
Student student = new Student();
student.setExamid(examid);
student.setIdcard(idcard);
student.setLocation(location);
student.setName(name);
student.setGrade(Double.parseDouble(grade));
StudentDao studentDao = new StudentDao();
studentDao.add(student);
System.out.println("恭喜:学生信息添加成功!");
}catch(Exception e){
e.printStackTrace();
System.out.println("对不起,学生信息数据添加失败!");
}
}else if(type.equalsIgnoreCase("f")){
//find student
System.out.println("请输入学生的准考证号");
StudentDao studentDao = new StudentDao();
String examid = reader.readLine();
Student student = studentDao.find(examid);
PrintStudentInfo(student);
}else if(type.equalsIgnoreCase("d")){
//delete student
System.out.println("请输入学生的姓名");
StudentDao studentDao = new StudentDao();
String name = reader.readLine();
studentDao.delete(name);
}else{
System.out.println("Not Support!");
}
}
private static void PrintStudentInfo(Student student) {
// TODO Auto-generated method stub
if(student!=null){
System.out.println("学生考号: \t" student.getExamid());
System.out.println("学生姓名: \t" student.getName());
System.out.println("学生身份证号码 : \t" student.getIdcard());
System.out.println("学生所在地: \t" student.getLocation());
System.out.println("学生成绩: \t" student.getGrade());
}
}
}