今天正式开学了。进行了Java开学考,结果不理想。但是令我认识到了自己的不足。
附上今天写的代码,并不完整以后完善。
import java.util.Scanner;
import java.util.Arrays;
import java.util.*;
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 missnumber;//表示当前工序的产品丢失总数
private int badnumber;//表示当前工序的产品废品数量
private int inspectednumber;//表示当前工序的产品待检验数量
private int statement;//表示该日报记录的状态,0表示初始计划,1表示日报提交,2表示日报确认
// 构造方法
public PlanInformation(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 inspectednumber, 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.inspectednumber = inspectednumber;
this.statement = statement;
}
// Getter 方法
public int getId() {
return id;
}
public String getPlanid() {
return planid;
}
public String getPlanname() {
return planname;
}
public String getProcess() {
return process;
}
public String getNextprocess() {
return nextprocess;
}
public String getOperator() {
return operator;
}
public String getRecipient() {
return recipient;
}
public int getPlannumber() {
return plannumber;
}
public int getInnumber() {
return innumber;
}
public int getOutnumber() {
return outnumber;
}
public int getMissnumber() {
return missnumber;
}
public int getBadnumber() {
return badnumber;
}
public int getInspectednumber() {
return inspectednumber;
}
public int getStatement() {
return statement;
}
// Setter 方法
public void setId(int id) {
this.id = id;
}
public void setPlanid(String planid) {
this.planid = planid;
}
public void setPlanname(String planname) {
this.planname = planname;
}
public void setProcess(String process) {
this.process = process;
}
public void setNextprocess(String nextprocess) {
this.nextprocess = nextprocess;
}
public void setOperator(String operator) {
this.operator = operator;
}
public void setRecipient(String recipient) {
this.recipient = recipient;
}
public void setPlannumber(int plannumber) {
this.plannumber = plannumber;
}
public void setInnumber(int innumber) {
this.innumber = innumber;
}
public void setOutnumber(int outnumber) {
this.outnumber = outnumber;
}
public void setMissnumber(int missnumber) {
this.missnumber = missnumber;
}
public void setBadnumber(int badnumber) {
this.badnumber = badnumber;
}
public void setInspectednumber(int inspectednumber) {
this.inspectednumber = inspectednumber;
}
public void setStatement(int statement) {
this.statement = statement;
}
}
class PlanManagement {
private PlanInformation[] plans;
private int planCount;
public PlanManagement() {
plans = new PlanInformation[5]; // 初始化数组,存储5个日报记录
planCount = 0;
}
// 方法:添加日报记录
public void addPlan(PlanInformation plan) {
if (planCount < plans.length) {
plans[planCount++] = plan;
} else {
System.out.println("日报记录已满,无法添加新的记录。");
}
}
// 主界面显示
public void showMainMenu() {
Scanner scanner = new Scanner(System.in);
int choice;
do {
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("**********************************************************");
System.out.print("请输入数字1-4选择功能:");
choice = scanner.nextInt();
switch (choice) {
case 1:
productplant();//生成计划
break;
case 2:
Submitreport();//提交日报
break;
case 3:
Comfirmreport();//确认日报
break;
case 4:
Trackprogress();//统计进度
break;
default:
System.out.println("错误:该选项不存在,请重新输入。");
break;
}
} while (choice != 0); // 可以添加退出条件,例如输入0退出系统
scanner.close();
}
private void productplant() {
Scanner scanner = new Scanner(System.in);
printHeader();
System.out.print("产品批次:");
String planid = scanner.nextLine();
System.out.print("产品名称:");
String planname = scanner.nextLine();
System.out.print("计划数量:");
String plannumber = scanner.nextLine();
};
private void Submitreport() {
printHeader();
};
private void Comfirmreport(){
printHeader();
};
private void Trackprogress(){
printHeader();
};
private void printHeader() {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学无限23软件开发有限公司");
System.out.println(" Mes系统2023版");
System.out.println("***********************************************************");
}
public static void main(String[] args) {
PlanManagement management = new PlanManagement();
management.showMainMenu();
}
}
标签:总结,String,int,void,System,private,学习,public From: https://www.cnblogs.com/buchi/p/18405568