zoukankan      html  css  js  c++  java
  • 学生 管理系统之测试

    public class ArrayListDemo {
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            Scanner sc = new Scanner(System.in);
            StudentsBiz stuBiz = new StudentsBiz();
            char flag = 'y';
            do {
    
                System.out.println("\t\t 学生管理系统");
                System.out.println("\t\t 1.增加学生信息");
                System.out.println("\t\t 2.修改学生信息");
                System.out.println("\t\t 3.查询学生信息");
                System.out.println("\t\t 4.删除学生信息");
                System.out.println("================================");
                System.out.println("请选择数字进行操作:");
                int which = sc.nextInt();
                String name = "";
                String age = "";
                String sex = "";
                String classes = "";
                Students stus = new Students();
                switch (which) {
                case 1:
                    System.out.println("请输入学生姓名:");
                    name = sc.next();
                    System.out.println("请输入学生年龄:");
                    age = sc.next();
                    System.out.println("请输入学生性别:");
                    sex = sc.next();
                    System.out.println("请输入学生班级:");
                    classes = sc.next();
                    stus.setName(name);
                    stus.setAge(age);
                    stus.setSex(sex);
                    stus.setClasses(classes);
                    // 调用业务类的 添加学生方法
                    stuBiz.addStu(stus);
                    break;
                case 2:
                    System.out.println("请输入学生姓名(姓名不可修改):");
                    name = sc.next();
                    System.out.println("请输入学生年龄:");
                    age = sc.next();
                    System.out.println("请输入学生性别:");
                    sex = sc.next();
                    System.out.println("请输入学生班级:");
                    classes = sc.next();
                    stus.setName(name);
                    stus.setAge(age);
                    stus.setSex(sex);
                    stus.setClasses(classes);
                    // 调用业务类的 添加学生方法
                    stuBiz.updateStu(stus);
                    break;
                case 3:
                    List myList = stuBiz.getList();
                    if(myList.size()>0){
                        System.out.println("\t姓名\t年龄\t性别\t班级");
                        System.out.println("=====================================");
                    }
                    for (int i = 0; i < myList.size(); i++) {
                        Students stu = (Students)myList.get(i);
                        System.out.print("\t"+stu.getName());
                        System.out.print("\t"+stu.getAge());
                        System.out.print("\t"+stu.getSex());
                        System.out.print("\t"+stu.getClasses());
                        System.out.print("\n");
                    }
                    break;
                case 4:
                    System.out.println("请输入删除的学生姓名:");
                    name = sc.next();
                    stuBiz.deleteStu(name);
                    break;
    
                default:
                    break;
                }
                System.out.println("操作成功,是否继续(y/n)");
                flag = sc.next().charAt(0);
            } while (flag=='y');
    
        }
    }
  • 相关阅读:
    Visual Studio 和 c# 正则表达式
    程序员DD 《Spring boot教程系列》补充
    c# 多线程编程中AutoResetEvent和ManualResetEvent
    c# 事件和EventManager
    卸载重装Mysql
    c# 语法要点速览
    在高分屏正确显示CHM文件
    ss user-rule自定义规则并硬连接到OneDrive进行自动同步
    利用webmagic获取天猫评论
    使用Selenium对新浪微博模拟登录
  • 原文地址:https://www.cnblogs.com/jintao/p/5280906.html
Copyright © 2011-2022 走看看