首页 > 其他分享 >开学前两周总结

开学前两周总结

时间:2024-09-20 20:25:37浏览次数:6  
标签:总结 开学 String 两周 list System println public out

增删改查

学生管理系统一

定义student类

public class student {
    //id name age address
    private String id;
    private String name;
    private int age;
    private String address;

    public student() {
    }

    public student(String id, String name, int age, String address) {
        this.id = id;
        this.name = name;
        this.age = age;
        this.address = address;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}

定义StudentSystem类

import java.sql.SQLOutput;
import java.util.ArrayList;
import java.util.Scanner;

public class StudentSystem {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<student> list = new ArrayList<>();
        loop :while (true) {
            System.out.println("-----------------欢迎来到学生管理系统-------------------");
            System.out.println("1.添加学生");
            System.out.println("2.删除学生");
            System.out.println("3.修改学生");
            System.out.println("4.查询学生");
            System.out.println("5.退出");
            System.out.println("请输入您的选择:");
            String choose = scanner.nextLine();
            switch (choose) {
                case "1" -> addStudent(list);
                case "2" -> deleteStudent(list);
                case "3" -> updateStudent(list);
                case "4" -> findStudent(list);
                case "5" ->
                {
                    System.out.println("退出");
                    break loop;
                }
                default -> System.out.println("没有这个选择");
            }
        }


    }
    //添加学生
    public static void addStudent(ArrayList<student> list) {
        System.out.println("添加学生");
        //利用空参构造创建学生对象
        student s = new student();
        Scanner scanner = new Scanner(System.in);
        while (true) {
        System.out.println("请输入学生id");
        String id = scanner.nextLine();
        boolean flag = contains(list, id);
        if (flag) {
            //表示id已经存在
            System.out.println("id已经存在,请重新输入");
        } else {
            //不存在
            s.setId(id);
            break;
        }
    }
        System.out.println("请输入学生姓名");
        String name = scanner.nextLine();
        s.setName(name);

        System.out.println("请输入学生的年龄");
        int age = scanner.nextInt();
        s.setAge(age);

        System.out.println("请输入学生的家庭住址");
        String address = scanner.next();
        s.setAddress(address);

        //把学生对象添加到集合当中
        list.add(s);
        //提示用户
        System.out.println("学生信息添加成功");
    }
    //删除学生
    public static void deleteStudent(ArrayList<student> list){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要删除的学生id");
        String id = scanner.nextLine();
        int index = getIndex(list,id);
        if (index >= 0) {
            list.remove(index);
            System.out.println("id为:" + id + "的学生删除成功");
        }else{
            System.out.println("id不存在,删除失败");
        }


    }
    //修改学生
    public static void updateStudent(ArrayList<student> list){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要修改的学生id");
        String id = scanner.nextLine();
        int index = getIndex(list,id);
        if (index == -1) {
            System.out.println("要修改的id" + id + "不存在,请重新输入");
            return;
        }
        student s = list.get(index);
        System.out.println("请输入要修改的学生姓名");
        String newName = scanner.nextLine();
        s.setName(newName);

        System.out.println("请输入要修改的学生家庭住址");
        String newAddress = scanner.nextLine();
        s.setAddress(newAddress);

        System.out.println("请输入要修改的学生年龄");
        int newAge = scanner.nextInt();
        s.setAge(newAge);
    }
    //查询学生
    public static void findStudent(ArrayList<student> list){
        System.out.println("查询学生");
        if(list.size() == 0){
            System.out.println("当前无信息,请添加后再查验");
            return;
        }
        //打印表头信息
        System.out.println("id\t姓名\t年龄\t家庭住址");
        //集合中存在数据
        for(int i = 0; i<list.size(); i++){
        student student = list.get(i);
        System.out.println(student.getId() + "\t" + student.getName() + "\t" + student.getAge() + "\t" + student.getAddress() );}
        }
    //判断id在集合中是否存在
    public static boolean contains (ArrayList<student> list,String id){
        //循环遍历集合得到里面的每一个学生对象
        for(int i = 0; i<list.size(); i++){
            if(list.get(i).getId().equals(id)){
                return true;
            }
        }
        return false;
    }
    //通过id获取索引
    public static int getIndex(ArrayList<student> list, String id){
        //遍历集合
        for(int i = 0; i<list.size(); i++){
            //得到每一个学生对象
            student student = list.get(i);
            String sid = student.getId();
            if(sid.equals(id)){
                return i;
            }
        }
        return -1;
    }
}

这个管理系统主要是跟着黑马程序员的教程写的

学生管理系统二

定义student类

public class student {

    private String stunumber;//学号
    private String name;//姓名
    private int age;//年龄
    private boolean sex;//性别
    private double score;//成绩

    public student() {
    }

    public student(String stunumber, String name, int age, boolean sex, double score) {
        this.stunumber = stunumber;
        this.name = name;
        this.age = age;
        this.sex = sex;
        this.score = score;
    }

    public String getStunumber() {
        return stunumber;
    }

    public void setStunumber(String stunumber) {
        this.stunumber = stunumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public boolean isSex() {
        return sex;
    }

    public void setSex(boolean sex) {
        this.sex = sex;
    }

    public double getScore() {
        return score;
    }

    public void setScore(double score) {
        this.score = score;
    }
}

定义StudentManager类

import java.util.ArrayList;
import java.util.Scanner;

public class StudentManager {
    //主界面
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<student> list = new ArrayList<>();
        loop1:
        while (true) {
            System.out.println("***************************************************************");
            System.out.println("石家庄铁道大学软件工程系学生信息管理系统");
            System.out.println("***************************************************************");
            System.out.println("1.遍历输出学生信息");
            System.out.println("2.新学生信息录入");
            System.out.println("3.删除学生信息");
            System.out.println("4.修改学生信息");
            System.out.println("5.查询学生信息");
            System.out.println("***************************************************************");
            System.out.println("请输入您的选择");
            String choice1 = sc.nextLine();
            switch (choice1) {
                case "1" -> showStudent(list);
                case "2" -> addStudent(list);
                case "3" -> deleteStudent(list);
                case "4" -> updateStudent(list);
                case "5" -> selectStudent(list);
                case "6" -> {
                    System.out.println("退出");
                    break loop1;
                }
                default -> System.out.println("没有这个选择");
            }
        }


    }

    //遍历输出
    public static void showStudent(ArrayList<student> list) {
        System.out.println("遍历输出");
        for (student item : list) {
            System.out.println("学号:" + item.getStunumber() +
                    ", 姓名:" + item.getName() +
                    ", 年龄:" + item.getAge() +
                    ", 性别:" + (item.isSex()? "男" : "女") +
                    ", 成绩:" + item.getScore());
        }
    }

    //新学生信息录入
    public static void addStudent(ArrayList<student> list) {
        System.out.println("录入学生信息");
        //创建学生对象
        student s = new student();
        Scanner sc = new Scanner(System.in);

        while (true) {
            System.out.println("请输入学生id");
            String stunumber = sc.nextLine();
            boolean flag = contains(list, stunumber);
            if (flag) {
                //表示id已经存在
                System.out.println("id已经存在,请重新输入");
            } else {
                //不存在
                s.setStunumber(stunumber);
                break;
            }

        }

        System.out.println("请输入学生姓名:");
        String name = sc.nextLine();
        s.setName(name);

        System.out.println("请输入学生年龄:");
        int age = sc.nextInt();
        s.setAge(age);

        boolean sex;
        System.out.println("请输入学生性别:");
        sc.nextLine();
        String gender = sc.nextLine();
        if (gender.equals("b")) {
            sex = false;
            s.setSex(sex);
        } else if (gender.equalsIgnoreCase("g")) {
            sex = true;
            s.setSex(sex);
        } else {
            System.out.println("输入无效");
        }
        //System.out.println("性别:" + (sex ? "女生" : "男生"));

        System.out.println("请输入学生成绩:");
        double score = sc.nextDouble();
        s.setScore(score);
        //添加学生信息
        list.add(s);
        System.out.println("学生信息添加成功");

    }

    //删除学生信息
    public static void deleteStudent(ArrayList<student> list) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要删除的学生学号:");
        String stunumber = sc.nextLine();
        int index = getIndex(list, stunumber);
        if (index >= 0) {
            list.remove(index);
            System.out.println("stunumber为:" + stunumber + "的学生删除成功");
        } else {
            System.out.println("不存在,删除失败");
        }

    }

    //修改学生信息
    public static void updateStudent(ArrayList<student> list) {
        System.out.println("修改学生信息");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入要修改的学生学号:");
        String stunumber = sc.nextLine();
        int index = getIndex(list, stunumber);
        if (index == -1) {
            System.out.println("没有该学生信息");
            return;
        }
        loop2:while (true) {
            System.out.println("请输入要修改的信息编号(1-5):");
            String choose2 = sc.nextLine();
            student s = list.get(index);
            switch (choose2) {
                case "1": {
                    System.out.println("请输入要修改的学号:");
                    String stunumber2 = sc.nextLine();
                    System.out.println("Y保存,N取消保存");
                    String choose3 = sc.nextLine();
                    switch (choose3) {
                        case "Y": {
                            System.out.println("修改成功!");
                             break loop2;
                        }
                        case "N": {
                            System.out.println("取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有该选项");
                    }
                }
                case "2": {
                    System.out.println("请输入要修改的姓名:");
                    String name2 = sc.nextLine();
                    System.out.println("Y保存,N取消保存");
                    String choose3 = sc.nextLine();
                    switch (choose3) {
                        case "Y": {
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有该选项");
                    }
                }
                case "3": {
                    System.out.println("请输入要修改的年龄:");
                    String age2 = sc.nextLine();
                    System.out.println("Y保存,N取消保存");
                    String choose3 = sc.nextLine();
                    switch (choose3) {
                        case "Y": {
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有该选项");
                    }
                }
                case "4": {
                    System.out.println("请输入要修改的性别:");
                    String sex2 = sc.nextLine();
                    System.out.println("Y保存,N取消保存");
                    String choose3 = sc.nextLine();
                    switch (choose3) {
                        case "Y": {
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有该选项");
                    }
                }
                case "5": {
                    System.out.println("请输入要修改的成绩:");
                    String score2 = sc.nextLine();
                    System.out.println("Y保存,N取消保存");
                    String choose3 = sc.nextLine();
                    switch (choose3) {
                        case "Y": {
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有该选项");
                    }
                }

            }
        }



    }

    //查询学生信息
    public static void selectStudent(ArrayList<student> list) {
        System.out.println("查询学生信息");
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入学生学号:");
        String stunumber = sc.nextLine();
        boolean flag = contains(list, stunumber);
        if (!flag) {
            System.out.println("库中没有该商品");
        } else {
            //System.out.println("学号\t姓名\t年龄\t性别\t成绩");
            for (int i = 0; i < list.size(); i++) {
                student student = list.get(i);
                System.out.println(student.getStunumber() + " " + student.getName() + " " + student.getAge() + " " + student.isSex() + " " + student.getScore());
            }
        }
    }

    //检查该学生信息是否存在
    public static boolean contains(ArrayList<student> list,String stunumber){
        //循环遍历集合得到里面的每一个学生对象
        for(int i = 0; i<list.size(); i++){
            if(list.get(i).getStunumber().equals(stunumber)){
                return true;
            }
        }
        return false;
    }

    //索引
    public static int getIndex(ArrayList<student> list, String stunumber) {
        // 遍历集合
        for (int i = 0; i < list.size(); i++) {
            student item = list.get(i);
            String itemNoInList = item.getStunumber();

            // 添加null检查
            if (itemNoInList != null && itemNoInList.equals(stunumber)) {
                return i;
            }
        }
        return -1;
    }
}

这是9月20日的摸底测试完成的

仓库管理系统

定义WarehouseInformation类

import java.lang.reflect.Constructor;

public class WarehouseInformation {
    //九个私有变量
    private String itemno;//商品编号
    private String itemname;//商品名称
    private String suppliername;//供货商名称
    private String warehousingtime;//入库时间
    private String shipmenttime;//出库时间
    private String warehousenumber;//仓库编号
    private String warehouseplace;//存放商品的具体位置
    private int itemnumber;//入库商品数量
    private int outnumber;//出库商品数量
    //空参
    public WarehouseInformation() {

    }
    //带全部参数的构造
    public WarehouseInformation(int outnumber, String itemno, String itemname, String suppliername, String warehousingtime, String shipmenttime, String warehousenumber, String warehouseplace, int itemnumber) {
        this.outnumber = outnumber;
        this.itemno = itemno;
        this.itemname = itemname;
        this.suppliername = suppliername;
        this.warehousingtime = warehousingtime;
        this.shipmenttime = shipmenttime;
        this.warehousenumber = warehousenumber;
        this.warehouseplace = warehouseplace;
        this.itemnumber = itemnumber;
    }
    //快捷键:Alt + Insert
    //或者Alt + Fn + Insert
    //选择Constructor +Select None -> 空参构造
    //全部参数构造:按住shift不松选中最后一个
    //get和set方法
    //选择Getter and Setter
    //插件:File + settings + Plugins + 搜索ptg + 右键 + ptg to javaBean

    public String getItemno() {
        return itemno;
    }
    public void setItemno(String itemno) {
        //局部变量表示测试类中调用方法传递过来的数据
        //等号的左边:表示成员位置的itemno
        this.itemno = itemno;
    }
    public String getItemname() {
        return itemname;
    }
    public void setItemname(String itemname) {
        this.itemname = itemname;
    }
    public String getSuppliername() {
        return suppliername;
    }
    public void setSuppliername(String suppliername) {
        this.suppliername = suppliername;
    }
    public String getWarehousingtime() {
        return warehousingtime;
    }
    public void setWarehousingtime(String warehousingtime) {
        this.warehousingtime = warehousingtime;
    }
    public String getShipmenttime() {
        return shipmenttime;
    }
    public void setShipmenttime(String shipmenttime) {
        this.shipmenttime = shipmenttime;
    }
    public String getWarehousenumber() {
        return warehousenumber;
    }
    public void setWarehousenumber(String warehousenumber) {
        this.warehousenumber = warehousenumber;
    }
    public String getWarehouseplace() {
        return warehouseplace;
    }
    public void setWarehouseplace(String warehouseplace) {
        this.warehouseplace = warehouseplace;
    }
    public int getItemnumber() {
        return itemnumber;
    }
    public void setItemnumber(int itemnumber) {
        this.itemnumber = itemnumber;
    }
    public int getOutnumber() {
        return outnumber;
    }
    public void setOutnumber(int outnumber) {
        this.outnumber = outnumber;
    }

}

定义WarehouseManagement类

import java.util.ArrayList;
import java.util.Scanner;

public class WarehouseManagement {

    //主界面
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<WarehouseInformation> list = new ArrayList<>();
        loop:
        while (true) {
            System.out.println("******************************************");
            System.out.println("石家庄铁道大学前进22软件开发有限公司");
            System.out.println("仓库管理系统2022版");
            System.out.println("******************************************");
            System.out.println("1.商品入库管理");
            System.out.println("2.商品信息修改");
            System.out.println("3.商品出库管理");
            System.out.println("4.仓库盘点管理");
            System.out.println("5.退出系统");
            System.out.println("******************************************");
            System.out.println("请输入您的选择:");
            String choose = sc.nextLine();
            switch (choose) {
                case "1" -> warehousing(list);
                case "2" -> update(list);
                case "3" -> delete(list);
                case "4" -> insert(list);
                case "5" -> {
                    System.out.println("退出成功!");
                    break loop;
                }
                default -> System.out.println("没有这个选项");
            }
        }


    }

    //商品入库管理
    public static void warehousing(ArrayList<WarehouseInformation> list) {
        System.out.println("商品入库管理");
        //创建商品信息
        //创建对象
        WarehouseInformation w = new WarehouseInformation();
        Scanner scanner = new Scanner(System.in);
        String itemno = "请输入商品编号";
        while (itemno.length() != 8){
            System.out.println("请输入商品编号(8位):");
            itemno = scanner.nextLine();
            if (itemno.length() != 8) {
                System.out.println("格式不满足要求,请重新输入。");
            }
        }
        w.setItemno(itemno);
        System.out.println("请输入商品名称:");
        String itemname = scanner.nextLine();
        w.setItemname(itemname);

        System.out.println("请输入供货商信息:");
        String suppliername = scanner.nextLine();
        w.setSuppliername(suppliername);

        System.out.println("请输入入库时间:");
        String warehousingtime = scanner.nextLine();
        w.setWarehousingtime(warehousingtime);

        System.out.println("请输入存放仓库号:");
        String warehousenumber = scanner.nextLine();
        w.setWarehousenumber(warehousenumber);

        System.out.println("请输入存放位置信息:");
        String warehouseplace = scanner.nextLine();
        w.setWarehouseplace(warehouseplace);

        System.out.println("入库商品数量:");
        int itemnumber = scanner.nextInt();
        w.setItemnumber(itemnumber);

        loop1:while (true) {
            System.out.println("******************************************");
            System.out.println("石家庄铁道大学前进22软件开发有限公司");
            System.out.println("仓库管理系统2022版");
            System.out.println("商品编号" + itemno);
            System.out.println("商品名称" + itemname);
            System.out.println("供货商信息" + suppliername);
            System.out.println("入库时间" + warehousingtime);
            System.out.println("存放仓库号" + warehousenumber);
            System.out.println("存放位置信息" + warehouseplace);
            System.out.println("入库商品数量" + itemnumber);
            System.out.println("该商品入库操作已完成,是否提交(Y/N)");

            scanner.nextLine();
            String choose8 = scanner.nextLine();
            switch (choose8) {
                case "Y": {
                    list.add(w);
                    System.out.println("已入库");
                    break loop1;
                }
                case "N":
                    System.out.println("用户已取消保存");
                    break loop1;
                default:
                    System.out.println("没有这个选项");
                    break;
            }

        }
    }

    //商品信息修改
    public static void update(ArrayList<WarehouseInformation> list) {
        System.out.println("商品信息修改");
        Scanner scanner = new Scanner(System.in);
        System.out.println("**************************************");
        System.out.println("石家庄铁道大学前进22软件开发有限公司");
        System.out.println("仓库管理系统2022版");
        System.out.println("**************************************");
        System.out.println("请输入商品编号:");
        String itemno = scanner.nextLine();

        System.out.println("**************************************");

        int index = getIndex(list, itemno);
        if (index == -1) {
            System.out.println("库中没有该商品,即将返回商品修改界面");
            return;
        }
        loop2:
        while (true) {
            System.out.println("**************************************");
            System.out.println("石家庄铁道大学前进22软件开发有限公司");
            System.out.println("仓库管理系统2022版");
            System.out.println("**************************************");

            if (list.get(index) != null) {
                //WarehouseInformation w = list.get(index);
                System.out.println("1、商品编号:" + list.get(index).getItemno());
                System.out.println("2、商品名称:" + list.get(index).getItemname());
                System.out.println("3、供货商信息:" + list.get(index).getSuppliername());
                System.out.println("4、入库时间:" + list.get(index).getWarehousingtime());
                System.out.println("5、存放仓库号:" + list.get(index).getWarehousenumber());
                System.out.println("6、存放位置信息:" + list.get(index).getWarehouseplace());
                System.out.println("7、入库商品数量:" + list.get(index).getItemnumber());
            }
            System.out.println("请选择需要修改的信息编号(1-7):");
            System.out.println("***************************************");
            String choose = scanner.nextLine();
            WarehouseInformation w = list.get(index);
            switch (choose) {
                case "1": {
                    System.out.println("请输入要修改的信息编号:");
                    String itemno2 = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose1 = scanner.nextLine();
                    switch (choose1) {
                        case "Y": {
                            w.setItemno(itemno2);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }
                }
                case "2": {
                    System.out.println("请输入要修改的商品名称:");
                    String itemname = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose2 = scanner.nextLine();
                    switch (choose2) {
                        case "Y": {
                            w.setItemname(itemname);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }
                }
                case "3": {
                    System.out.println("请输入要修改的供货商信息:");
                    String suppliername = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose3 = scanner.nextLine();
                    switch (choose3) {
                        case "Y": {
                            w.setSuppliername(suppliername);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }


                }
                case "4": {
                    System.out.println("请输入要修改的入库时间:");
                    String warehousingtime = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose4 = scanner.nextLine();
                    switch (choose4) {
                        case "Y": {
                            w.setWarehousingtime(warehousingtime);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }
                }
                case "5": {
                    System.out.println("请输入要修改的存放仓库号:");
                    String warehousenumber = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose5 = scanner.nextLine();
                    switch (choose5) {
                        case "Y": {
                            w.setWarehousenumber(warehousenumber);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }

                }
                case "6": {
                    System.out.println("请输入要修改的商品存放位置信息:");
                    String warehouseplace = scanner.nextLine();
                    System.out.println("Y保存修改;N取消保存");
                    String choose6 = scanner.nextLine();
                    switch (choose6) {
                        case "Y": {
                            w.setWarehousenumber(warehouseplace);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }

                }
                case "7": {
                    System.out.println("请输入要修改的入库商品数量:");
                    int itemnumber = scanner.nextInt();
                    System.out.println("Y保存修改;N取消保存");
                    String choose7 = scanner.nextLine();
                    switch (choose7) {
                        case "Y": {
                            w.setItemnumber(itemnumber);
                            System.out.println("修改成功!");
                            break loop2;
                        }
                        case "N": {
                            System.out.println("用户已取消保存");
                            break loop2;
                        }
                        default:
                            System.out.println("没有这个选项");
                    }
                }
                default:
                    System.out.println("没有这个选项");
            }
        }
    }

    //商品出库管理
    public static void delete(ArrayList<WarehouseInformation> list) {
        System.out.println("商品出库管理");
        WarehouseInformation w = new WarehouseInformation();
        Scanner scanner = new Scanner(System.in);
        loop3:while (true) {
            System.out.println("***************************************");
            System.out.println("石家庄铁道大学前进22软件开发有限公司");
            System.out.println("仓库管理系统2022版");
            System.out.println("***************************************");
            String itemno3 = "";
            while (itemno3.length() != 8){
                System.out.println("请输入商品编号(8位):");
                itemno3 = scanner.nextLine();
                if (itemno3.length() != 8) {
                    System.out.println("格式不满足要求,请重新输入。");
                }
            }
            w.setItemno(itemno3);
            System.out.println("***************************************");

            //itemno3-->index
            loop4 :while (true) {
                boolean flag = contains(list, itemno3);
                if (!flag) {
                    System.out.println("库中没有该商品");
                } else {
                    int index = getIndex(list, itemno3);
                    System.out.println("***************************************");
                    System.out.println("石家庄铁道大学前进22软件开发有限公司");
                    System.out.println("仓库管理系统2022版");
                    System.out.println("**************************************");
                    System.out.println("1、商品编号:" +list.get(index).getItemno());
                    System.out.println("2、商品名称:" + list.get(index).getItemname());
                    System.out.println("3、供货商信息:" + list.get(index).getSuppliername());
                    System.out.println("4、入库时间:" + list.get(index).getWarehousingtime());
                    System.out.println("5、存放仓库号:" + list.get(index).getWarehousenumber());
                    System.out.println("6、存放位置信息:" + list.get(index).getWarehouseplace());
                    System.out.println("7、入库商品数量:" + list.get(index).getItemnumber());

                    System.out.println("请输入出库时间:");
                    String shipmenttime = scanner.nextLine();
                    list.get(index).setShipmenttime(shipmenttime);

                    System.out.println("请输入出库数量:");
                    int outnumber = scanner.nextInt();
                    list.get(index).setOutnumber(outnumber);

                    System.out.println("Y保存;N取消保存");
                    Scanner sc = new Scanner(System.in);
                    scanner.nextLine();
                    String choose7 = sc.nextLine();
                    switch (choose7) {
                        case "Y": {
                            System.out.println("保存成功!");
                            break loop3;
                        }
                        case "N": break loop4 ;
                        default:
                            System.out.println("没有这个选项");
                    }

                }
            }
        }


    }

    //仓库盘点管理
    public static void insert(ArrayList<WarehouseInformation> list) {
        System.out.println("仓库盘点管理");
        System.out.println("***************************************");
        System.out.println("石家庄铁道大学前进22软件开发有限公司");
        System.out.println("仓库管理系统2022版");
        System.out.println("**************************************");

        //for循环遍历全部sout
        //index 是从0,1,2……
        int number ;

        for (int i = 0; i < list.size(); i++) {
            WarehouseInformation item = list.get(i);
            String itemNoInList = item.getItemno();
            int outnumber1 = item.getOutnumber();
            int itemnumber2 = item.getItemnumber();
            number = itemnumber2 - outnumber1;
            System.out.println((i+1) + "、  "+ "商品编号:" + itemNoInList + "、商品名称:" + item.getItemname() + "、库存数量:" + number );
        }
    }

    //判断itemno在集合中是否存在
    /*public static boolean contains(ArrayList<WarehouseInformation> list, String itemno) {
        //循环遍历集合得到里面的每一个对象
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getItemno().equals(itemno)) {
                return true;
            }
        }
        return false;
    }*/
    public static boolean contains(ArrayList<WarehouseInformation> list, String itemno) {
        if (list == null || itemno == null) {
            return false;//表示列表中不可能包含指定的项目编号
        }
        for (WarehouseInformation info : list) {//遍历对象
            if (info.getItemno()!= null && info.getItemno().equals(itemno)) {
                return true;
            }
        }
        return false;
    }

    //条件查询,特定项的索引
    public static int getIndex(ArrayList<WarehouseInformation> list, String itemno) {
        // 遍历集合
        for (int i = 0; i < list.size(); i++) {
            WarehouseInformation item = list.get(i);
            String itemNoInList = item.getItemno();

            // 添加null检查
            if (itemNoInList != null && itemNoInList.equals(itemno)) {
                return i;
            }
        }
        return -1;
    }
}

生产管理系统

定义PlanInformation类

public class PlanInformation {
    //十四个私有变量
    private int id;//日报流水号
    private String planid;//产品生产批次号
    private String planname;//产品名称
    private String process;//当前工序名称
    private String nextprocess;//下一接受工序名称
    private String operator;//当前工序的操作者
    private String recipient;//下一道工序的接受者
    private int plannumber;//产品数量
    private int innumber;//上一道工序的接收的合格产品总数
    private int outnumber;//产品转出总数
    private int misnumber;//产品丢失数量
    private int badnumber;//产品废品数量
    private int inspectednumber;//产品待检验数量
    private int statement;//日报记录的状态
    //空参构造
    public PlanInformation() {

    }
    //带全部参数的构造
    public PlanInformation(int id, String planid, String planname, String process, String nextprocess, String operator, String recipient, int plannumber, int innumber, int outnumber, int misnumber, int badnumber, int inspectednumber, int statenumber) {
        this.id = id;
        this.planid = planid;
        this.planname = planname;
        this.process = process;
        this.nextprocess = nextprocess;
        this.operator = operator;
        this.recipient = recipient;
        this.plannumber = plannumber;
        this.innumber = innumber;
        this.outnumber = outnumber;
        this.misnumber = misnumber;
        this.badnumber = badnumber;
        this.inspectednumber = inspectednumber;
        this.statement = statenumber;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getPlanid() {
        return planid;
    }

    public void setPlanid(String planid) {
        this.planid = planid;
    }

    public String getPlanname() {
        return planname;
    }

    public void setPlanname(String planname) {
        this.planname = planname;
    }

    public String getProcess() {
        return process;
    }

    public void setProcess(String process) {
        this.process = process;
    }

    public String getNextprocess() {
        return nextprocess;
    }

    public void setNextprocess(String nextprocess) {
        this.nextprocess = nextprocess;
    }

    public String getOperator() {
        return operator;
    }

    public void setOperator(String operator) {
        this.operator = operator;
    }

    public String getRecipient() {
        return recipient;
    }

    public void setRecipient(String recipient) {
        this.recipient = recipient;
    }

    public int getPlannumber() {
        return plannumber;
    }

    public void setPlannumber(int plannumber) {
        this.plannumber = plannumber;
    }

    public int getInnumber() {
        return innumber;
    }

    public void setInnumber(int innumber) {
        this.innumber = innumber;
    }

    public int getOutnumber() {
        return outnumber;
    }

    public void setOutnumber(int outnumber) {
        this.outnumber = outnumber;
    }

    public int getMisnumber() {
        return misnumber;
    }

    public void setMisnumber(int misnumber) {
        this.misnumber = misnumber;
    }

    public int getBadnumber() {
        return badnumber;
    }

    public void setBadnumber(int badnumber) {
        this.badnumber = badnumber;
    }

    public int getInspectednumber() {
        return inspectednumber;
    }

    public void setInspectednumber(int inspectednumber) {
        this.inspectednumber = inspectednumber;
    }

    public int getStatement() {
        return statement;
    }

    public void setStatement(int statenumber) {
        this.statement = statenumber;
    }
}

定义PlanManagement类

import jdk.swing.interop.SwingInterOpUtils;

import java.util.ArrayList;
import java.util.Scanner;

public class PlanManagement {
    //主界面
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<PlanInformation> list = new ArrayList<>();
        loop:while (true) {
            System.out.println("***********************************************************");
            System.out.println("石家庄铁道大学无限23软件开发有限公司");
            System.out.println("Mes系统2023版");
            System.out.println("***********************************************************");
            System.out.println("1、生成计划");
            System.out.println("2、提交日报");
            System.out.println("3、确认日报");
            System.out.println("4、统计进度");
            System.out.println("5、退出系统");
            System.out.println("***********************************************************");
            System.out.println("请输入您的选择:");
            String choice = sc.nextLine();
            switch (choice) {
                case "1" -> produce(list);
                case "2" -> submit(list);
                case "3" -> confuse(list);
                case "4" -> statistics(list);
                case "5" -> {
                    System.out.println("退出成功!");
                    break loop;
                }
                default -> System.out.println("没有该选项");
            }
        }


    }

    //生产计划管理功能操作流程
    public static void produce(ArrayList<PlanInformation> list) {
        System.out.println("生产计划");
        //创建信息
        PlanInformation p = new PlanInformation();
        Scanner sc = new Scanner(System.in);
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("***********************************************************");

        //System.out.println("请输入产品批次:");
        String planid = "请输入产品批次";
        while (planid.length() != 8){
            System.out.println("请输入产品批次:");
            planid = sc.nextLine();
            p.setPlanid(planid);
            if (planid.length() != 8) {
                System.out.println("格式不满足要求,请重新输入。");
            }
        }
        //String planid = sc.nextLine();
        //p.setPlanid(planid);

        System.out.println("请输入产品名称:");
        String planname = sc.nextLine();
        p.setPlanname(planname);

        System.out.println("请输入计划数量:");
        int plannumber = sc.nextInt();
        p.setPlannumber(plannumber);


        loop1:while (true) {
            System.out.println("***********************************************************");
            System.out.println("石家庄铁道大学无限23软件开发有限公司");
            System.out.println("Mes系统2023版");
            System.out.println("***********************************************************");
            System.out.println("产品批次:" + planid);
            System.out.println("产品名称:" + planname);
            System.out.println("计划数量:" + plannumber);
            System.out.println("该产品入库操作已完成,是否提交(Y/N)");
            //System.out.println("***********************************************************");
            sc.nextLine();
            String choice1 = sc.nextLine().toUpperCase();
            switch (choice1) {
                case "Y" : {
                    list.add(p);
                    p.setStatement(0);
                    System.out.println("已入库");
                    break loop1;
                }
                case "N" : {
                    System.out.println("用户取消保存");
                    break loop1;
                }
                default:
                    System.out.println("没有这个选项");
                    break;
            }
        }


    }

    //验证格式是否正确
    private static boolean isValidPlanId(String planid) {
        return planid.matches("\\d{4}-\\d{3}");
    }

    //提交日报
    public static void submit(ArrayList<PlanInformation> list) {
        Scanner sc = new Scanner(System.in);
        System.out.println("提交日报");
        loop3:while (true) {
            System.out.println("***********************************************************");
            System.out.println("石家庄铁道大学无限23软件开发有限公司");
            System.out.println("Mes系统2023版");
            System.out.println("***********************************************************");

            //System.out.println("请输入产品批次号:");
            String planid = "请输入产品批次";
            while (planid.length() != 8){
                System.out.println("请输入产品批次(8位):");
                planid = sc.nextLine();
                if (planid.length() != 8) {
                    System.out.println("格式不满足要求,请重新输入。");
                }
            }
            //System.out.println("***********************************************************");
            int index = getIndex(list, planid);
            if(index == -1){
                System.out.println("库中不存在该产品批次信息,没有该产品计划");
                return;
            }
            PlanInformation p = list.get(index);
            if(list.get(index).getStatement() == 0) {
                System.out.println("***********************************************************");
                System.out.println("石家庄铁道大学无限23软件开发有限公司");
                System.out.println("Mes系统2023版");
                System.out.println("***********************************************************");
                System.out.println("1、产品批次:" + list.get(index).getPlanid());
                System.out.println("2、产品名称:" + list.get(index).getPlanname());
                System.out.println("3、计划数量:" + list.get(index).getPlannumber());
            } else if(list.get(index).getStatement() == 2){
                System.out.println("***********************************************************");
                System.out.println("石家庄铁道大学无限23软件开发有限公司");
                System.out.println("Mes系统2023版");
                System.out.println("***********************************************************");
                System.out.println("1、产品批次:" + list.get(index).getPlanid());
                System.out.println("2、产品名称:" + list.get(index).getPlanname());
                System.out.println("3、计划数量:" + list.get(index).getPlannumber());
                System.out.println("4、当前工序:" + list.get(index).getProcess());
                System.out.println("5、下一工序:" + list.get(index).getNextprocess());
                System.out.println("6、操作员:(自动生成,根据工序号)");
                System.out.println("7、接收员:(自动生成根据工序号)");
                System.out.println("8、上一道工序转入数量:" + p.getInnumber());

            }

            System.out.println("请输入当前工序:");
            String process = sc.nextLine();
            p.setProcess(process);

            System.out.println("请输入下一工序:");
            String nextprocess = sc.nextLine();
            p.setNextprocess(nextprocess);


            //自动生成
            System.out.println("操作员:(自动生成,根据工序号)");
            System.out.println("接受员:(自动生成,根据工序号)");

            if (list.get(index).getStatement() == 0) {
                System.out.println("上一道工序转入数量:");
                int innumber = sc.nextInt();
                p.setInnumber(innumber);
            }

            System.out.println("转出总数:");
            int outnumber = sc.nextInt();
            p.setOutnumber(outnumber);

            System.out.println("丢失数量:");
            int misnumber = sc.nextInt();
            p.setMisnumber(misnumber);

            System.out.println("废品数量:");
            int badnumber = sc.nextInt();
            p.setBadnumber(badnumber);

            System.out.println("待检验数量:");
            int inspectednumber  = sc.nextInt();
            p.setInspectednumber(inspectednumber);

            int totalExpectedInnumber = outnumber + misnumber + badnumber + inspectednumber;
            if(p.getInnumber()!= totalExpectedInnumber) {
                System.out.println("录入错误信息,请更改丢失数量、废品数量、待检验数量和转出总数。");
                break loop3;
            }

            System.out.println("***********************************************************");
            System.out.println("是否保存提交(Y/N)");
            sc.nextLine();
            String choice2 = sc.nextLine().toUpperCase();
            switch (choice2) {
                case "Y" : {
                    if(p.getStatement()==0 || p.getStatement()==2) {
                        p.setStatement(1);
                    }
                    System.out.println("已保存");
                    //list.add(p);
                    break loop3;
                }
                case "N" : {
                    System.out.println("未保存");
                    break;
                }
                default:
                    System.out.println("没有该选项,返回主界面");
                    break;
            }
        }


    }

    //确认日报管理
    public static void confuse(ArrayList<PlanInformation> list) {
        System.out.println("确认日报");
        //PlanInformation p = new PlanInformation();
        Scanner sc = new Scanner(System.in);
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("*********************************************************");
        //System.out.println("请输入产品批次:");
        loop9 : while (true) {
            String planid = "请输入产品批次";
            while (planid.length() != 8){
                System.out.println("请输入产品批次(8位):");
                planid = sc.nextLine();
                if (planid.length() != 8) {
                    System.out.println("格式不满足要求,请重新输入。");
                }
            }
            int index = getIndex(list, planid);
            if(index == -1){
                System.out.println("库中不存在该产品批次信息,没有该产品计划");
                return;
            }
            PlanInformation p = list.get(index);
            System.out.println("***********************************************************");
            System.out.println("石家庄铁道大学无限23软件开发有限公司");
            System.out.println("Mes系统2023版");
            System.out.println("***********************************************************");
            System.out.println("1、产品批次:" + list.get(index).getPlanid());
            System.out.println("2、产品名称:" + list.get(index).getPlanname());
            System.out.println("3、计划数量:" + list.get(index).getPlannumber());
            System.out.println("4、当前工序:" + list.get(index).getProcess());
            System.out.println("5、下一工序" + list.get(index).getNextprocess());
            System.out.println("6、操作员:(自动生成,根据工序号)");
            System.out.println("7、接受员:(自动生成,根据工序号)");
            System.out.println("8、上一道工序转入数量:" + list.get(index).getInnumber());
            System.out.println("9、转出总数:" + list.get(index).getOutnumber());
            System.out.println("10、丢失数量:" + list.get(index).getMisnumber());
            System.out.println("11、废品数量:" + list.get(index).getBadnumber());
            System.out.println("12、待检验数量:" + list.get(index).getInspectednumber());
            System.out.println("***********************************************************");
                System.out.println("请输入Y/N");
                String choose3 = sc.nextLine().toUpperCase();//转为大写以统一处理
                switch (choose3) {
                    case "Y": {
                        System.out.println("***********************************************************");
                        System.out.println("石家庄铁道大学无限23软件开发有限公司");
                        System.out.println("Mes系统2023版");
                        System.out.println("***********************************************************");
                        System.out.println("1、产品批次:" + list.get(index).getPlanid());
                        System.out.println("2、产品名称:" + list.get(index).getPlanname());
                        System.out.println("3、计划数量:" + list.get(index).getPlannumber());
                        System.out.println("4、当前工序:" + list.get(index).getProcess());
                        System.out.println("5、下一工序:" + list.get(index).getNextprocess());
                        System.out.println("6、操作员:(自动生成,根据工序号)");
                        System.out.println("7、接受员:(自动生成,根据工序号)");
                        System.out.println("8、上一道工序转入数量:" + list.get(index).getInnumber());
                        System.out.println("***********************************************************");
                        //将批次状态ststement设置成为2
                        p.setStatement(2);
                        break loop9;
                    }
                    case "N" : {
                        System.out.println("返回当前界面");
                        break;
                    }
                    default : {
                        System.out.println("无效选项");
                        break;
                    }

                }
        }

    }

    //统计进度
    public static void statistics(ArrayList<PlanInformation> list) {
        System.out.println("统计进度");
        //PlanInformation p = new PlanInformation();
        Scanner sc = new Scanner(System.in);
        System.out.println("***********************************************************");
        System.out.println("石家庄铁道大学无限23软件开发有限公司");
        System.out.println("Mes系统2023版");
        System.out.println("***********************************************************");

        for (int i = 0; i < list.size(); i++) {
            PlanInformation p1 = list.get(i);
            String planid = p1.getPlanid();
            System.out.println("1、产品批次:" + p1.getPlanid());
            String planname = p1.getPlanname();
            System.out.println("2、产品名称:" + p1.getPlanname());
            //int plannumber = p1.getPlannumber();
            System.out.println("3、计划数量:" + p1.getPlannumber());
            //完成数量
            int innumber = p1.getInnumber();
            int outnumber = p1.getOutnumber();
            System.out.println("4、完成数量:" + p1.getOutnumber());
            //剩余数量
            int plannumber1 = p1.getPlannumber();
            int remainingNumber = plannumber1 - outnumber;
            System.out.println("5、剩余数量:" + remainingNumber);

        }
        System.out.println("***********************************************************");


    }

    //条件查询
    public static int getIndex(ArrayList<PlanInformation> list, String planid) {
        // 遍历集合
        for (int i = 0; i < list.size(); i++) {
            PlanInformation item = list.get(i);
            String itemNoInList = item.getPlanid();

            // 添加null检查
            if (itemNoInList != null && itemNoInList.equals(planid)) {
                return i;
            }
        }
        return -1;
    }

}

主要是9月9日开学测试完成的,后面也对一部分进行了修改和补充

毕业论文管理系统

定义ScoreInformation类

public class ScoreInformation {
    //七个私有变量
    private String stunumber;//存储学号
    private String name;//存储姓名
    private String stuclass;//存储班级
    private String papertitie;//存储论文标题
    private String paperbody;//存储论文正文
    private double paperpass;//存储查重率
    private boolean paperreview;//存储最终审查效果
    //空参
    public ScoreInformation() {
    }
    //带全部参数的构造

    public ScoreInformation(String stunumber, String name, String stuclass, String papertitie, String paperbody, double paperpass, boolean paperreview) {
        this.stunumber = stunumber;
        this.name = name;
        this.stuclass = stuclass;
        this.papertitie = papertitie;
        this.paperbody = paperbody;
        this.paperpass = paperpass;
        this.paperreview = paperreview;
    }

    public String getStunumber() {
        return stunumber;
    }

    public void setStunumber(String stunumber) {
        this.stunumber = stunumber;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getStuclass() {
        return stuclass;
    }

    public void setStuclass(String stuclass) {
        this.stuclass = stuclass;
    }

    public String getPapertitle() {
        return papertitie;
    }

    public void setPapertitie(String papertitie) {
        this.papertitie = papertitie;
    }

    public String getPaperbody() {
        return paperbody;
    }

    public void setPaperbody(String paperbody) {
        this.paperbody = paperbody;
    }

    public double getPaperpass() {
        return paperpass;
    }

    public void setPaperpass(double paperpass) {
        this.paperpass = paperpass;
    }

    public boolean isPaperreview() {
        return paperreview;
    }

    public void setPaperreview(boolean paperreview) {
        this.paperreview = paperreview;
    }
}

定义PaperManagement类

import java.util.ArrayList;
import java.util.Scanner;

public class PaperManagement {
    //主界面
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        ArrayList<ScoreInformation> list = new ArrayList<>();
        loop:
        while (true) {
            System.out.println("******************************************");
            System.out.println("石家庄铁道大学软件工程系");
            System.out.println("毕业设计论文管理系统2021版");
            System.out.println("******************************************");
            System.out.println("1.毕业设计论文提交");
            System.out.println("2.毕业设计论文查重");
            System.out.println("3.毕业设计论文审查");
            System.out.println("4.退出论文管理系统");
            System.out.println("******************************************");
            System.out.println("请输入您的选择:");
            String choose = sc.nextLine();
            switch (choose) {
                case "1" -> submit(list);
                case "2" -> check(list);
                case "3" -> review(list);
                case "4" -> {
                    System.out.println("******************************************");
                    System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
                    System.out.println("制作人:郝一诺");
                    System.out.println("******************************************");
                    break loop;
                }
                default -> System.out.println("没有这个选项(错误信息)");
            }
        }
    }

    //毕业设计论文提交
    public static void submit(ArrayList<ScoreInformation> list) {
        System.out.println("毕业设计论文提交");
        ScoreInformation p = new ScoreInformation();
        Scanner scanner = new Scanner(System.in);
        System.out.println("******************************************");
        System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
        System.out.println("毕业设计论文提交");
        System.out.println("******************************************");
        //System.out.println("请输入学生学号:");
        //System.out.println("******************************************");
        String stunumber = "请输入学生学号";
        while (stunumber.length() != 8){
            System.out.println("请输入学生学号:");
            stunumber = scanner.nextLine();
            p.setStunumber(stunumber);
            if (stunumber.length() != 8) {
                System.out.println("格式不满足要求,请重新输入。");
            }
        }


        System.out.println("请输入学生姓名:");
        String name = scanner.nextLine();
        p.setName(name);

        System.out.println("请输入所在班级:");
        String stuclass = scanner.nextLine();
        p.setStuclass(stuclass);


        loop1:while (true) {
            System.out.println("******************************************");
            System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
            System.out.println("毕业设计论文提交");
            System.out.println("学生学号" + stunumber);
            System.out.println("学生姓名" + name);
            System.out.println("所在班级" + stuclass);
            //System.out.println("请输入毕业论文设计题目:");
            //String papertitle = " ";
            //p.setPapertitie(papertitle);
            while (true) {
                System.out.println("请输入毕业论文设计题目:(不超过十个字符):");
                String papertitle = scanner.nextLine();
                p.setPapertitie(papertitle);
                if (papertitle.length() > 10) {
                    System.out.println("格式不满足要求,请重新输入。");
                } else {
                    break;
                }
            }
            System.out.println("******************************************");
            while (true) {
                System.out.println("请输入毕业论文设计正文:");
                String paperbody = scanner.nextLine();
                p.setPaperbody(paperbody);
                if (paperbody.length() > 200) {
                    System.out.println("超过两百个字符,请重新输入");
                } else {
                    break;
                }
            }
            list.add(p);

            int index = getIndex(list, stunumber);
            if (index == -1) {
                System.out.println("该学号不存在");
                return;
            }
            System.out.println("输入END代表论文正文输入完成");
            String finish = scanner.nextLine();
            if (finish.equals("END")) {
                System.out.println("**************************************");
                System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
                System.out.println("毕业设计论文提交");
                System.out.println("**************************************");
                System.out.println("学生学号:" + list.get(index).getStunumber());
                System.out.println("学生姓名:" + list.get(index).getName());
                System.out.println("所在班级:" + list.get(index).getStuclass());
                System.out.println("毕业设计论文题目:" + list.get(index).getPapertitle());
                System.out.println("毕业设计论文正文" + list.get(index).getPaperbody());

                System.out.println("该学生论文录入完毕,是否提交(Y/N)");
                String choose8 = scanner.nextLine();
                switch (choose8) {
                    case "Y": {
                        list.add(p);
                        System.out.println("已提交");
                        break loop1;
                    }
                    case "N":
                        System.out.println("学生已取消保存");
                        break loop1;
                    default:
                        System.out.println("没有这个选项");
                        break;
                }

            }
        }
    }

    //毕业设计论文查重
    public static void check(ArrayList<ScoreInformation> list) {
        System.out.println("毕业设计论文查重");
        //ScoreInformation p1 = new ScoreInformation();
        Scanner sc = new Scanner(System.in);
        loop2:while (true) {
            System.out.println("*****************************************");
            System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
            System.out.println("毕业设计论文查重");
            System.out.println("******************************************");

            System.out.println("请输入学生学号(8位):");
            String stunumber = sc.next();

            int index = getIndex(list, stunumber);
            if (index == -1) {
                System.out.println("该学号不存在");
                return;
            }
            ScoreInformation p = list.get(index);

            System.out.println("学生学号:" + list.get(index).getStunumber());
            System.out.println("学生姓名:" + list.get(index).getName());
            System.out.println("所在班级:" + list.get(index).getStuclass());
            System.out.println("毕业设计论文题目:" + list.get(index).getPapertitle());
            System.out.println("毕业设计论文正文" + list.get(index).getPaperbody());
            System.out.println("请输入毕业论文查重率:");

            double paperpass = sc.nextDouble();
            p.setPaperpass(paperpass);
            //list.add(p1);
            if (paperpass <= 0.2) {
                System.out.println("符合要求");
                System.out.println("学生学号:" + list.get(index).getStunumber());
                System.out.println("学生姓名:" + list.get(index).getName());
                System.out.println("所在班级:" + list.get(index).getStuclass());
                System.out.println("毕业设计论文题目:" + list.get(index).getPapertitle());
                System.out.println("毕业设计论文正文" + list.get(index).getPaperbody());
                System.out.println("毕业设计论文查重率:" + paperpass);
                System.out.println("请输入Y/N");
                Scanner scanner = new Scanner(System.in);
                String choose8 = scanner.nextLine();
                switch (choose8) {
                    case "Y": {
                        p.setPaperpass(paperpass);
                        list.add(p);
                        System.out.println("正在返回论文查重界面");
                        break loop2;
                    }
                    case "N":
                        break loop2;
                }

            }else{
                break;
            }
        }



    }

    //毕业设计论文审查
    public static void review(ArrayList<ScoreInformation> list) {
        Scanner sc = new Scanner(System.in);
        System.out.println("毕业设计论文审查");
        loop3:while (true) {
            System.out.println("******************************************");
            System.out.println("石家庄铁道大学软件工程系毕业设计论文管理系统2021版");
            System.out.println("毕业设计论文审查");
            System.out.println("******************************************");
            System.out.println("请输入学生学号(8位):");
            String stunumber = sc.nextLine();
            int index = getIndex(list, stunumber);
            if (index == -1) {
                System.out.println("该学号不存在");
                return;
            }
            System.out.println("学生学号:" + list.get(index).getStunumber());
            System.out.println("学生姓名:" + list.get(index).getName());
            System.out.println("所在班级:" + list.get(index).getStuclass());
            System.out.println("毕业设计论文题目:" + list.get(index).getPapertitle());
            System.out.println("毕业设计论文正文" + list.get(index).getPaperbody());
            System.out.println("请输入毕业论文查重率:" + list.get(index).getPaperpass());
            if (list.get(index).getPaperpass() >= 0.2) {
                System.out.println("该学生毕业设计论文重复率超过20%,不允许进行论文审查");
                return;
            }
            System.out.println("***********************************************");
            System.out.println("学生学号:" + list.get(index).getStunumber());
            System.out.println("学生姓名:" + list.get(index).getName());
            System.out.println("所在班级:" + list.get(index).getStuclass());
            System.out.println("毕业设计论文题目:" + list.get(index).getPapertitle());
            System.out.println("毕业设计论文正文" + list.get(index).getPaperbody());
            System.out.println("请输入毕业论文查重率:" + list.get(index).getPaperpass());
            System.out.println("是否同意该学生参加毕业设计答辩:(Y/N)");
            Scanner scanner = new Scanner(System.in);
            String choose9 = scanner.nextLine();
            switch (choose9) {
                case "Y": {
                    list.add(list.get(index));
                    break loop3;
                }
                case "N":
                    break;
            }
        }


    }

    //判断正文是否输出完成
    public static void check2(ArrayList<ScoreInformation> list) {

    }

    //条件查询
    public static int getIndex(ArrayList<ScoreInformation> list, String stunumber) {
        // 遍历集合
        for (int i = 0; i < list.size(); i++) {
            ScoreInformation item = list.get(i);
            String itemNoInList = item.getStunumber();

            // 添加null检查
            if (itemNoInList != null && itemNoInList.equals(stunumber)) {
                return i;
            }
        }
        return -1;
    }

}

这两周的练习和测试内容就这些,或多或少存在着一些bug,需要进一步修改和完善。

标签:总结,开学,String,两周,list,System,println,public,out
From: https://www.cnblogs.com/haoyinuo/p/18423216

相关文章

  • 第三周《密码系统设计》学习总结思维导图
      marmaid代码为:graphLR  A[密码系统设计第三周]-->B[《WindowsC/C++加密解密实战》]  B-->C[第四章]  C-->T[4.2加密基础]  W-->U[CryptoAPI介绍]  T-->V[加密概念]  T-->X[加密类型]  X-->d[对称加密]  X-->......
  • WPF 模板总结(Template)
    模板(Template):WPF系统不但支持传统的Winfrom编程的用户界面和用户体验设计,更支持使用专门的设计工具Blend进行专业设计,同时还推出了以模板为核心的新一代设计理念。在WPF中,通过引入模板(Template)微软将数据和算法的“内容”与“形式”解耦了。模板是算法和数据的外衣,决定了它们......
  • 每日总结
    最近也是搞hadoop,hbase,zookeeper,phoenix,这四个东西,到处配置也是够累了,主要是网上的资料不是很详细,都有所不同,也不知道怎么去配置。就只能看很多的文章去筛选,但是差的就是细节,比如Linux的操作命令,有些变量不知道是不是要改成自己的。还有软件的版本适配的问题,教程都是几年前......
  • NOIP2024集训 Day33 总结
    前言若巅峰不在,那就重踏来时之路。今天是\(\texttt{DP}\)优化专题,感觉只要写出了暴力,剩下的部分都挺典的。怎么说,感觉今天状态不太好,老是细节上出现一些很逆天的错误。例如:for(autoi=dp.begin();i!=dp.end();++i){pair<ll,ll>j=*i;ans=j.first......
  • 修改IP地址的方法有哪些?总结8个方法
    更改IP地址是一个常见的需求,无论是为了保护个人隐私、绕过地理限制还是进行商业数据分析。不同的IP更改方法适用于不同的需求和环境。但请注意,更改IP地址应在合法场景下进行,无论使用什么方法,都需要在符合当地网络安全法律法规的情况下进行,切勿违法操作。1、重启路由器:这种方......
  • 杂题总结 Vol.3
    杂题总结Vol.3\(\def\EZ{\textcolor{#51af44}{\text{EZ}}}\EZ\)表示简单,10分钟内就能想到。\(\def\HD{\textcolor{#3173b3}{\text{HD}}}\HD\)表示中等,能独立想出\(\def\IN{\textcolor{#be2d23}{\text{IN}}}\IN\)表示困难,独立思考能想到\(50\%\)以上\(\def\AT{\textcolor......
  • MySQL强化篇指优化思路总结
    基础--连接退出数据库连接:mysql-h地址-P接口-u用户名-p密码退出:exit或者/q数据库操作关键字create创建数据库createdatabase数据库名如:createdatabasetestdefaultcharsetutf8关键字show查看当前有哪些数据库showdatabase;查看创建数据库的语句......
  • React升级18总结
    升级1818有哪些更新root节点的处理//旧ReactDOM.render(<App/>,document.getElementById('root'));//新constroot=createRoot(document.getElementById("root"));root.render(App);render中移除了回调函数//旧constcontainer=document.getElementB......
  • 代码随想录总结篇
    数组一般是排序以及索引问题链表翻转,重组,环问题哈希(map)hash暂存结果实现时间复杂度缩小字符串翻转,kmp算法,最长公共序列双指针快慢指针,左右指针栈队列先入先出后入先出二叉树二叉树dfs,bfsdfs计算深度高度二叉搜索树相关问题回溯递归三部曲参数返回值,终止条......
  • 2024.09.19短时训练赛总结
    $T1$感觉没有蓝,只有中绿左右。赛时写了正解,漏了个$+$号,寄了,然后逆元处理了$inv$,但是不知道为什么写的是快速幂,于是就T了。考虑枚举两端改变,中间随便的区间$[i,j]$,然后乱搞即可。$\color{black}{zzzcr}$有一个$O(n)$的做法是考虑双指针,然后对于有交的区......