用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字

请选择技术分类

 *如果你找不到更细的分类,可以选择上级分类
当前位置:云代码 - 技术问答 - Java

学生信息管理系统

 悬赏:100|提问者:晓怪兽|浏览:2106
举报|2016-12-19
有图形界面,
能连接Mysql数据库
能完成数据的查询,添加,删除,修改

我来回答

所有回答
举报|(1)|(1)2016-12-27
怎么赚积分?
举报|(1)|(1)2017-02-23
这个一般的系统都可以做到的呀 一般的CMS都可以做到的 很见到的
举报|(1)|(1)2017-03-03
一般系统就行了
举报|(1)|(1)2017-03-10
这是要定向开发吗?如果需要的话,可以与我联系 QQ3615101
举报|(1)|(1)2017-04-17
??
举报|(1)|(1)2017-05-11
自己努力做吧,看好你
#7
举报|(1)|(1)2017-06-07
aaa
举报|(1)|(1)2017-06-11
额外的
举报|(1)|(1)2017-07-14
怎么赚积分
举报|(2)|(1)2017-12-26
import java.util.Scanner;
 
/**
 * 旅店管理系统(控制台版)
 *
 */
public class HotelManager {
    private static String[][] rooms;// 表示房间
 
    public static void main(String[] args) {
        rooms = new String[10][12];
        String comm;// 表示用户输入的命令
        for (int i = 0; i < rooms.length; i++) {
            for (int j = 0; j < rooms[0].length; j++) {
                rooms[i][j] = "EMPTY";
            }
        }
 
        while (true) {
            System.out.println("欢迎光临【程序猿】旅店,请输入命令:");
            Scanner sca = new Scanner(System.in);
            System.gc();
            comm = sca.next();
            if ("search".equalsIgnoreCase(comm)) {
                search();
            } else if ("in".equalsIgnoreCase(comm)) {
                int roomNo = sca.nextInt();
                String name = sca.next();
                in(roomNo, name);
            } else if ("out".equalsIgnoreCase(comm)) {
                int roomNo = sca.nextInt();
                out(roomNo);
            } else if ("exit".equalsIgnoreCase(comm)) {
                System.out.println("程序退出...");
                break;
 
            } else if ("help".equalsIgnoreCase(comm)) {
                System.out
                        .println(" in命令格式:in 房号 姓名\n out命令格式:out 房号 姓名\n search命令:查看所有房间状态 \n exit命令:退出");
            } else {
                System.out.println("命令输入错误,请重新输入:");
            }
 
        }
 
    }
 
    private static void out(int roomNo) {
        if ("EMPTY".equals(rooms[(roomNo / 100) - 1][(roomNo % 100) - 1])) {
            System.out.println("该房间没有客人入住,退房失败!");
            return;
        }
        rooms[(roomNo / 100) - 1][(roomNo % 100) - 1] = "EMPTY";
        System.out.println(roomNo + "退房成功!");
 
    }
 
    private static void in(int roomNo, String name) {
        if (!"EMPTY".equals(rooms[(roomNo / 100) - 1][(roomNo % 100) - 1])) {
            System.out.println("该房间已经有客人入住!");
            return;
        }
        rooms[(roomNo / 100) - 1][(roomNo % 100) - 1] = name;
        System.out.println(name + "成功入住" + roomNo + "房间!");
 
    }
 
    private static void search() {
        for (int i = 0; i < rooms.length; i++) {
            // 打印房间号
            for (int j = 0; j < rooms[0].length; j++) {
                if (j + 1 < 10) {
                    System.out.print(i + 1 + "0" + (j + 1) + "  ");
                } else {
                    System.out.print(i + 1 + "" + (j + 1) + "   ");
                }
            }
            // 打印房间状态
            System.out.println();
            for (int j = 0; j < rooms[0].length; j++) {
                System.out.print(rooms[i][j] + "    ");
            }
            System.out.println();
        }
 
    }
 
}

举报|(1)|(1)2018-01-09
举报|(1)|(1)2018-02-08
举报|(1)|(1)2018-03-13
很普通的系统啊
举报|(1)|(1)2018-03-18
百度一下
举报|(1)|(1)2018-04-21
??
举报|(1)|(1)2018-11-15
.
#17542
举报|(1)|(1)2018-12-25
1111111
举报|(1)|(1)2019-05-25
QS
举报|(1)|(1)2019-06-02
222
举报|(1)|(1)2020-02-07
举报|(1)|(1)2020-03-26
packagecom.iflytek.studentmanagesystem.view;
 
importjava.util.Comparator;
importjava.util.List;
importjava.util.Scanner;
 
importcom.iflytek.studentmanagesystem.pojo.Student;
importcom.iflytek.studentmanagesystem.service.StudentService;
importcom.iflytek.studentmanagesystem.service.impl.StudentServiceImpl;
importcom.iflytek.studentmanagesystem.util.DateUtil;
 
publicclassMainClass {
 
    publicstaticvoidmain(String[] args) {
        while(true) {
            System.out.println("#######欢迎使用xxxx学生管理系统#######");
            System.out.println("1.增加学生信息\n2.删除学生信息\n3.修改学生信息\n4.查询学生信息\n0.退出系统\n请选择:");
            Scanner sc =newScanner(System.in);
            intselect = sc.nextInt();
            if(select ==0) {
                break;
            }elseif(select ==1) {
                doAddStudent();
            }elseif(select ==2) {
                doDeleteStudent();
            }elseif(select ==3) {
                doModifyStudent();
            }elseif(select ==4) {
                doQeuryStudent();
            }else{
                System.out.println("错误的功能代码!");
            }
        }
    }
 
      
    privatestaticvoiddoAddStudent() {
        // TODO Auto-generated method stub
        StudentService service =newStudentServiceImpl();
        Scanner sc =newScanner(System.in);
        System.out.println("输入要新增的学生的学号:");
        intnumber = sc.nextInt();
        if(service.queryByNumber(number) !=null) {
            System.out.println("该学号对应的学生信息已经存在!");
            return;
        }
        sc.nextLine();// 消除前面输入整数留下的回车符
        System.out.println("输入要新增的学生姓名:");
        String name = sc.nextLine();
        System.out.println("请输入要新增的学生性别:");
        String gender = sc.nextLine();
        System.out.println("请输入要新增的学生出生日期(如1990-1-1):");
        String birthday = sc.nextLine();
        System.out.println("请输入要新增的学生入学日期(如2019-9-1):");
        String entranceday = sc.nextLine();
 
        Student stu =newStudent();
        stu.setNumber(number);
        stu.setName(name);
        stu.setGender(gender);
        stu.setBirthday(DateUtil.str2date(birthday));
        stu.setEntranceday(DateUtil.str2date(entranceday));
 
        if(1== service.add(stu)) {
            System.out.println("学生信息新增完成!");
        }else{
            System.out.println("学生信息增加失败!");
        }
    }
 
 
    privatestaticvoiddoDeleteStudent() {
        StudentService service =newStudentServiceImpl();
        Scanner sc =newScanner(System.in);
        System.out.println("输入要删除的学生的学号:");
        intnumber = sc.nextInt();
        if(0== service.delete(number)) {
            System.out.println("学生信息不存在,删除失败!");
        }else{
            System.out.println("学生信息删除完成!");
        }
    }
 
    privatestaticvoiddoModifyStudent() {
        StudentService service =newStudentServiceImpl();
        Scanner sc =newScanner(System.in);
        System.out.println("输入要修改的学生的学号:");
        intnumber = sc.nextInt();
        if(service.queryByNumber(number) ==null) {
            System.out.println("该学号对应的学生信息不存在,无法修改!");
            return;
        }
        sc.nextLine();
        System.out.println("输入要修改的学生新的姓名:");
        String name = sc.nextLine();
        System.out.println("请输入要修改的学生新的性别:");
        String gender = sc.nextLine();
        System.out.println("请输入要修改的学生新的出生日期(如1990-1-1):");
        String birthday = sc.nextLine();
        System.out.println("请输入要修改的学生新的入学日期(如2019-9-1):");
        String entranceday = sc.nextLine();
 
        Student stu =newStudent();
        stu.setNumber(number);
        stu.setName(name);
        stu.setGender(gender);
        stu.setBirthday(DateUtil.str2date(birthday));
        stu.setEntranceday(DateUtil.str2date(entranceday));
 
        if(1== service.modify(stu)) {
            System.out.println("学生信息修改完成!");
        }else{
            System.out.println("学生信息修改失败!");
        }
 
    }
 
    privatestaticvoiddoQeuryStudent() {
        StudentService service =newStudentServiceImpl();
        while(true) {
            System.out.println("1.按学号查询\n2.按姓名查询\n3.查看所有\n4.按年龄降序查看所有\n0.返回\n请选择:");
            Scanner sc =newScanner(System.in);
            intselect = sc.nextInt();
            if(select ==0) {
                break;
            }elseif(select ==1) {
                System.out.println("输入要查询的学生的学号:");
                intnumber = sc.nextInt();
                Student stu = service.queryByNumber(number);
                if(stu ==null) {
                    System.out.println("未查询到相关信息");
                }else{
                    System.out.println("查询到学生的信息:\n"+ stu);
                }
            }elseif(select ==2) {
                System.out.println("输入要查询的学生的姓名:");
                String name = sc.next();
                List<Student> stus = service.queryByName(name);
                if(stus.size() ==0) {
                    System.out.println("未查询到相关信息");
                }else{
                    System.out.println("查询到学生的信息:");
                    for(inti =0; i < stus.size(); i++) {
                        System.out.println(stus.get(i));
                    }
                }
            }elseif(select ==3) {
                System.out.println("所有学生的信息:");
                List<Student> stus = service.queryAll();
                for(inti =0; i < stus.size(); i++) {
                    System.out.println(stus.get(i));
                }
            }elseif(select ==4) {
                System.out.println("按年龄降序排列学生的信息:");
                List<Student> stus = service.queryAll();
                stus.sort(newComparator<Student>() {
 
                    @Override
                    publicintcompare(Student o1, Student o2) {
                        return(int) (o2.getBirthday().getTime() - o1.getBirthday().getTime());
                    }
                });
                for(inti =0; i < stus.size(); i++) {
                    System.out.println(stus.get(i));
                }
            }else{
                System.out.println("错误的功能代码!");
            }
        }
    }
 
}
举报|(1)|(1)2021-11-28
这个一般的系统都可以做到的呀 一般的CMS都可以做到的 很见到的
举报|(1)|(1)2022-01-11
对我的

相关提问