java学习9.13

news/2025/1/15 17:25:23/文章来源:https://www.cnblogs.com/zangbotao/p/18412659

将java测试卷重新完成,测试完后基本完成需求,无明显BUG

结合课堂上去写这个java测试卷,总的来说,之前没有独立写过类似项目+限时是比较大的问题。

如果之前没有经历类似的情况,很多功能都是第一次用,那么就会导致出现bug而不知道如何去改,并且加上时间限制,如果时间全花在改bug上,又无法完成项目的需求。
除此之外,如果没有项目经验,那么还会导致项目一开始的结构就很混乱,无法做到逐渐实现一块块功能,而是直接从上到下直接垒。

public class Main {public static void main(String[] args) {Planmanager pm = new Planmanager();pm.page();}
}class PlaneInformation {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 missnumber;//当前工序的产品丢失数量private  int badnumber;//前工序的产品废品数量private int inspectednubmer;//当前工序的产品待检验数量private int statement;//表示该日报记录的状态,0表示初始计划,1表示日报提交,2表示日报确认。public PlaneInformation() {}public void PlaneInformation(int id, String planid, String planname, String process, String nextprocess, String operator, String recipient, int plannumber, int innumber, int outnumber, int missnumber, int badnumber, int inspectednubmer, int statement) {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.missnumber = missnumber;this.badnumber = badnumber;this.inspectednubmer = inspectednubmer;this.statement = statement;}public void  PlaneInformation() {}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 getMissnumber() {return missnumber;}public void setMissnumber(int missnumber) {this.missnumber = missnumber;}public int getBadnumber() {return badnumber;}public void setBadnumber(int badnumber) {this.badnumber = badnumber;}public int getInspectednubmer() {return inspectednubmer;}public void setInspectednubmer(int inspectednubmer) {this.inspectednubmer = inspectednubmer;}public int getStatement() {return statement;}public void setStatement(int statement) {this.statement = statement;}
}import java.util.Scanner;
class Person
{int id;String Theworkname;String operator;public Person(int id,  String theworkname, String operator) {this.id = id;Theworkname = theworkname;this.operator = operator;}public int getId() {return id;}public void setId(int id) {this.id = id;}public String getTheworkname() {return Theworkname;}public void setTheworkname(String theworkname) {Theworkname = theworkname;}public String getOperator() {return operator;}public void setOperator(String operator) {this.operator = operator;}
}public class Planmanager {PlaneInformation planeInformation[] = new PlaneInformation[1000];Person person[] = new Person[15];int idd = 0;public void page() {person[1] = new Person(1, "10.射蜡", "羽");person[2] = new Person(2, "20.修蜡", "哲");person[3] = new Person(3, "30.面层", "诺");person[4] = new Person(4, "40.封浆", "铎");person[5] = new Person(5, "50.熔化", "恒");person[6] = new Person(6, "60.切割", "印");person[7] = new Person(7, "70.精磨", "文");person[8] = new Person(8, "80.调型", "正");person[9] = new Person(9, "90.检验", "静");person[10] = new Person(10, "0.无", "无");person[11] = new Person(11, "-1.无", "无");boolean k = true;Scanner scc = new Scanner(System.in);while (k) {//主页面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.退出系统");int Thechoice = scc.nextInt();switch (Thechoice) {//1、生成计划"case 1: {Creatework();break;}//2、提交日报case 2: {{Submitreport();}break;}//3、确认日报case 3: {Confirmreport();break;}//4、统计进度case 4: {Statisticprogress();break;}//退出系统case 5: {k = false;break;}default: {System.out.println("该选项不存在");}}}}public void Creatework() {boolean kk = true;while (kk) {Scanner sc = new Scanner(System.in);System.out.println("产品批次:");String planid = sc.next();while (planid.length() < 8 || planid.charAt(4) != '-') {System.out.println("输入有问题,请重新输入产品批次号");planid = sc.next();}System.out.println("产品名称:");String planename1 = sc.next();System.out.println("计划数量:");int plannumber1 = sc.nextInt();System.out.println("产品批次" + planid);System.out.println("产品名称“" + planename1);System.out.println("计划数量" + plannumber1);System.out.println("该产品入库操作已完成,是否提交(Y/N)");String yesno = sc.next();planeInformation[0] = new PlaneInformation();if (yesno.equals("Y")) {planeInformation[0].setPlanid(planid);planeInformation[0].setPlanname(planename1);planeInformation[0].setPlannumber(plannumber1);planeInformation[0].setStatement(0);planeInformation[0].setInnumber(plannumber1);System.out.println("提交成功!");kk = false;}}}public void Submitreport() {Scanner sc = new Scanner(System.in);System.out.println("请输入产品序列号");String planid = sc.next();for (int i = 0; i < planeInformation.length; i++) {if (planeInformation[i].getPlanid().equals(planid)) {if (planeInformation[i].getStatement() == 0) {System.out.println("1.产品批次:" + planeInformation[i].getPlanid());System.out.println("2.产品名称:" + planeInformation[i].getPlanname());System.out.println("3.计划数量:" + planeInformation[i].getPlannumber());planeInformation[i].setProcess(person[1].Theworkname);System.out.println("4.当前工序:"+planeInformation[i].getProcess());planeInformation[i].setNextprocess(person[2].Theworkname);System.out.println("5.下一工序:"+planeInformation[i].getNextprocess());planeInformation[i].setOperator(person[1].operator);planeInformation[i].setRecipient(person[2].operator);System.out.println("6.操作员:" + planeInformation[i].getOperator());System.out.println("7.接收员:" + planeInformation[i].getRecipient());System.out.println("8.上一道工序转入数量:"+planeInformation[i].getInnumber());System.out.println("9.转出总数:");int outnumber = sc.nextInt();System.out.println("10.丢失数量:");int missnumber = sc.nextInt();System.out.println("11.废品数量:");int badnumber = sc.nextInt();System.out.println("12.待检验数量:");int inspectednubmer = sc.nextInt();while (planeInformation[i].getInnumber() != outnumber + missnumber + badnumber + inspectednubmer) {System.out.println("录入错误信息,请重新输入以下信息");System.out.println("9.转出总数:");outnumber = sc.nextInt();System.out.println("10.丢失数量:");missnumber = sc.nextInt();System.out.println("11.废品数量:");badnumber = sc.nextInt();System.out.println("12.待检验数量:");inspectednubmer = sc.nextInt();}System.out.println("选择“Y”将修改信息保存提交。选择“N”,不保存修改信息");String yesno1 = sc.next();if (yesno1.equals("Y")) {planeInformation[i].setOutnumber(outnumber);planeInformation[i].setMissnumber(missnumber);planeInformation[i].setBadnumber(badnumber);planeInformation[i].setInspectednubmer(inspectednubmer);planeInformation[i].setStatement(1);planeInformation[i].setId(idd);System.out.println("提交成功");}break;} else if (planeInformation[i].getStatement() == 2) {System.out.println("1.产品批次:" + planeInformation[i].getPlanid());System.out.println("2.产品名称:" + planeInformation[i].getPlanname());System.out.println("3.计划数量:" + planeInformation[i].getPlannumber());System.out.println("4.当前工序:" + planeInformation[i].getProcess());System.out.println("5.下一工序:" + planeInformation[i].getNextprocess());System.out.println("6.操作员:" + planeInformation[i].getOperator());System.out.println("7.接收员:" + planeInformation[i].getRecipient());System.out.println("8.上一道工序转入数量:" + planeInformation[i].getInnumber());System.out.println("9.转出总数:");int outnumber = sc.nextInt();System.out.println("10.丢失数量:");int missnumber = sc.nextInt();System.out.println("11.废品数量:");int badnumber = sc.nextInt();System.out.println("12.待检验数量:");int inspectednubmer = sc.nextInt();while (planeInformation[i].getInnumber() != outnumber + missnumber + badnumber + inspectednubmer) {System.out.println("录入错误信息,请重新输入以下信息");System.out.println("9.转出总数:");outnumber = sc.nextInt();System.out.println("10.丢失数量:");missnumber = sc.nextInt();System.out.println("11.废品数量:");badnumber = sc.nextInt();System.out.println("12.待检验数量:");inspectednubmer = sc.nextInt();}System.out.println("选择“Y”将修改信息保存提交。选择“N”,不保存修改信息");String yesno1 = sc.next();if (yesno1.equals("Y")) {planeInformation[i].setOutnumber(outnumber);planeInformation[i].setMissnumber(missnumber);planeInformation[i].setBadnumber(badnumber);planeInformation[i].setInspectednubmer(inspectednubmer);planeInformation[i].setStatement(1);System.out.println("提交成功");}break;}} else {System.out.println("库中没有该产品计划");}}}public void Confirmreport() {Scanner sc = new Scanner(System.in);System.out.println("请输入产品序列号");String planid = sc.next();for (int i = 0; i < planeInformation.length; i++) {if (planeInformation[i].getPlanid().equals(planid)) {if (planeInformation[i].getStatement() == 1) {System.out.println("1.产品批次:" + planeInformation[i].getPlanid());System.out.println("2.产品名称:" + planeInformation[i].getPlanname());System.out.println("3.计划数量:" + planeInformation[i].getPlannumber());System.out.println("4.当前工序:" + planeInformation[i].getProcess());System.out.println("5.下一工序:" + planeInformation[i].getNextprocess());System.out.println("6.操作员:" + planeInformation[i].getOperator());System.out.println("7.接收员:" + planeInformation[i].getRecipient());System.out.println("8.上一道工序转入数量:" + planeInformation[i].getInnumber());System.out.println("9.转出总数:" + planeInformation[i].getOutnumber());System.out.println("10.丢失数量:" + planeInformation[i].getMissnumber());System.out.println("11.废品数量:" + planeInformation[i].getBadnumber());System.out.println("12.待检验数量:" + planeInformation[i].getInspectednubmer());System.out.println("选择Y/N来确认结果");String yesno1 = sc.next();if (yesno1.equals("Y")) {planeInformation[i].setStatement(2);planeInformation[i].setProcess(planeInformation[i].getNextprocess());planeInformation[i].setOperator(planeInformation[i].getRecipient());planeInformation[i].setInnumber(planeInformation[i].getOutnumber());char x = planeInformation[i].getNextprocess().charAt(0);int xx = x - '0';planeInformation[i].setNextprocess(person[xx + 1].getTheworkname());planeInformation[i].setRecipient(person[xx + 1].getOperator());System.out.println("确认成功");}System.out.println("1.产品批次:" + planeInformation[i].getPlanid());System.out.println("2.产品名称:" + planeInformation[i].getPlanname());System.out.println("3.计划数量:" + planeInformation[i].getPlannumber());System.out.println("4.当前工序:" + planeInformation[i].getProcess());System.out.println("5.下一工序:" + planeInformation[i].getNextprocess());System.out.println("6.操作员:" + planeInformation[i].getOperator());System.out.println("7.接收员:" + planeInformation[i].getRecipient());System.out.println("8.上一道工序转入数量:" + planeInformation[i].getInnumber());System.out.println("9.转出总数:" + planeInformation[i].getOutnumber());System.out.println("10.丢失数量:" + planeInformation[i].getMissnumber());System.out.println("11.废品数量:" + planeInformation[i].getBadnumber());System.out.println("12.待检验数量:" + planeInformation[i].getInspectednubmer());break;}else {System.out.println("请先提交日报");break;}}}}public void Statisticprogress() {Scanner sc = new Scanner(System.in);System.out.println("请输入产品序列号");String planid = sc.next();for (int i = 0; i < planeInformation.length; i++) {if (planeInformation[i].getPlanid().equals(planid)) {System.out.println("1.产品批次:" + planeInformation[i].getPlanid());System.out.println("2.产品名称:"+planeInformation[i].getPlanname());System.out.println("3.计划数量:"+planeInformation[i].getPlannumber());char x = planeInformation[i].getProcess().charAt(0);int xx = x - '0';if(xx==0){System.out.println("4.完成数量:"+planeInformation[i].getOutnumber());System.out.println("5.剩余数量"+(planeInformation[i].getPlannumber()-planeInformation[i].getOutnumber()));}else{System.out.println("4.完成数量:"+0);System.out.println("5.剩余数量"+(planeInformation[i].getPlannumber()));}break;}}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/796661.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

来云栖大会!探展云上开发,沉浸式体验云原生 + AI 新奇玩法

计算馆将展示中国最先进的云计算产业链全景,从底层硬件到数据创新,从云计算基础设施到数据管理服务、人工智能平台和模型服务,全景式呈现 AI 时代云计算最新技术形态和产品进展。2024 云栖大会来了! 本届云栖大会将于 9 月 19 日至 9 月 21 日 在杭州云栖小镇召开 汇集全球…

最后的记录

最后的挣扎但是做的题太少了根本算不上长征。 写这个是因为 NOIP2024 剩百日,这他妈是最后一次了,就让我拿个一等吧,别无所求了。 把之前做过的题都重新总结一遍,怎么说也都能吃透了。 P6880 JOI 2020 Final] オリンピックバス 给一个有向图,经过边有代价 \(C_i\),可以反…

ENSP 某台设备出现乱码的情况

故障现象:新建拓扑没问题,打开其他人发的拓扑就会出现乱码(或者打开ENSP的示例也会出现问题),配置文档正常可以正常导出不受影响。 故障发现时间:2022年底 故障原因:windows系统BUG,常见于inter 13代CPU(例如I5-13500) 处理方法1:重装系统(一劳永逸) 处理方法2:例…

10、Linux文本编辑器

文本编辑器 常见文本编辑器 WindowsNotepad(记事本) Sublime UltraEditLinuxVI/VIM nano Emacs Sed gedit KateVI 和 VIM 的区别VI全称:Visual Interface 创建时间:1976年 创建者:Bill JoyVIM全称:VI IMproved,即 VI 的升级版 创建时间:1991年 创建者:Bram Moolenaar …

vue2 + scss 全局引入 变量使用

百度以及时AI帮助说的配置方式都大差不差,但是我的总是报错,意思就是变量找不到,报错如下 For a guide and recipes on how to configure / customize this project,<br> 然后AI和文章写的vue.config.js的配置内容基本如下module.exports = {css: {loaderOptions: {scss:…

2024金砖大赛网络安全赛项区域选拔赛-简单的rce

1. Echo写入一句话木马蚁剑连接木马根目录下找到flag

Google Colab 简单使用

使用Google Colab需要谷歌账号和一点点魔法。注册好账号,找到我的云盘,可以点击右上角的log 跳转。我的云端银盘这里可以选择上传文件还是文件夹,还可以新建文件夹然后在这个文件夹中选择你要上传的文件。例如我这创建了一个train_test 的文件夹,然后上传了 test_ScVgIM0.z…

Go runtime 调度器精讲(四):运行 main goroutine

原创文章,欢迎转载,转载请注明出处,谢谢。0. 前言 皇天不负有心人,终于我们到了运行 main goroutine 环节了。让我们走起来,看看一个 goroutine 到底是怎么运行的。 1. 运行 goroutine 稍微回顾下前面的内容,第一讲 Go 程序初始化,介绍了 Go 程序是怎么进入到 runtime 的…

Python网页应用开发神器Dash 2.18.1稳定版本来啦

本文示例代码已上传至我的Github仓库:https://github.com/CNFeffery/dash-master Gitee同步仓库地址:https://gitee.com/cnfeffery/dash-master大家好我是费老师,上周Dash发布了2.18.0新版本,并于今天发布了可稳定使用的2.18.1版本(自古.1版本最稳✌),今天的文章中就将针…

吊打面试官!从多维度理解架构

大家好,我是汤师爷~ 在工作当中,我们经常会听到以下说法:产品负责人说,现在的业务架构太复杂,需要仔细梳理下。 技术领导说,这个项目很复杂,需要做下系统架构方案评审。 研发经理说,这次秒杀活动访问量非常大,需要用到高并发架构方案。 一线研发说,互联网大厂都会用到…

数组的下标越界

1.数组下标 数组的下标通俗来讲是数组中数据的代号,例如a[0]=1,即数组下标0代表1 2.下标越界 假设创建的数组内存为3(a=new int[3]),则数组的下标为0,1,2. 如果多输出了下标3,则会显示下标越界。 1.正常数组的输出2.下标越界的输出(即提示你数组下标越界异常!) 3.数组…

转载:国产操作系统麒麟v10、UOS在线打开excel文件并动态赋值

在实际的开发过程中,经常会遇到数据库中的数据填充到excel生成一份正式文件的功能,PageOffice客户端控件支持在线预览Excel文件时,通过Workbook对象来实现对Excel文件的数据填充功能,如果只是简单的填充一下数据,那么通过调用Sheet对象的openCell方法获取到Cell对象并赋值…