首页 > 其他分享 >开学考试

开学考试

时间:2024-09-28 21:47:06浏览次数:5  
标签:开学 String int System println public 考试 out

import java.util.Scanner;

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;

public PlanInformation(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.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;
}


public int getId() {
    return 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 getInspectednumber() {
    return inspectednumber;
}

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

public int getStatement() {
    return statement;
}

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

}

class PlanManagement {
private PlanInformation[] records;
private int recordCount;

public PlanManagement() {
    records = new PlanInformation[5]; // 存储最多五个日报记录
    recordCount = 0;
}

// 主界面
public void displayMainMenu() {
    Scanner scanner = new Scanner(System.in);
    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("***********************************************************");
        System.out.print("请选择功能(1-4):");
        int choice = scanner.nextInt();
        switch (choice) {
            case 1:
                generatePlan();
                break;
            case 2:
                submitReport();
                break;
            case 3:
                confirmReport();
                break;
            case 4:
                statistics();
                break;
            default:
                System.out.println("该选项不存在,请重新选择。");
                break;
        }
    }
}

// 生成计划(方法体为空,可根据需求实现)
private void generatePlan() {
    // 生成计划的逻辑
    System.out.println("生成计划的功能尚未实现。");
}

// 提交日报
private void submitReport() {
    if (recordCount >= 5) {
        System.out.println("日报记录已满,无法提交新日报。");
        return;
    }

    Scanner scanner = new Scanner(System.in);
    System.out.print("请输入产品批次(格式:yyyy-xxx,8位):");
    String planid = scanner.nextLine();
    System.out.print("请输入产品名称:");
    String planname = scanner.nextLine();
    System.out.print("请输入当前工序:");
    String process = scanner.nextLine();
    System.out.print("请输入下一工序:");
    String nextprocess = scanner.nextLine();
    System.out.print("请输入操作员:");
    String operator = scanner.nextLine();
    System.out.print("请输入接收员:");
    String recipient = scanner.nextLine();
    System.out.print("请输入计划数量:");
    int plannumber = scanner.nextInt();
    System.out.print("请输入转入数量:");
    int innumber = scanner.nextInt();
    System.out.print("请输入转出总数:");
    int outnumber = scanner.nextInt();
    System.out.print("请输入丢失数量:");
    int missnumber = scanner.nextInt();
    System.out.print("请输入废品数量:");
    int badnumber = scanner.nextInt();
    System.out.print("请输入待检验数量:");
    int inspectednumber = scanner.nextInt();
    int statement = 0; // 初始状态

    PlanInformation newRecord = new PlanInformation(planid, planname, process, nextprocess, operator, recipient,
            plannumber, innumber, outnumber, missnumber, badnumber, inspectednumber, statement);
    records[recordCount++] = newRecord;
    System.out.println("日报提交成功!");
}

// 确认日报
private void confirmReport() {
    Scanner scanner = new Scanner(System.in);
    System.out.print("请输入产品批次(格式:yyyy-xxx,8位):");
    String planid = scanner.nextLine();

    PlanInformation foundRecord = null;
    for (PlanInformation record : records) {
        if (record != null && record.getPlanid().equals(planid) && record.getStatement() == 1) {
            foundRecord = record;
            break;
        }
    }

    if (foundRecord == null) {
        System.out.println("库中没有该产品批次或状态不正确。");
        return;
    }

    // 显示日报信息
    displayRecord(foundRecord);

    System.out.print("确认结果(Y/N):");
    String confirmation = scanner.next();
    if (confirmation.equalsIgnoreCase("Y")) {
        // 生成新的生产任务记录逻辑
        foundRecord.setStatement(2); // 状态设置为确认
        System.out.println("日报确认成功!");
        displayRecord(foundRecord); // 重新显示确认后的日报信息
    } else {
        System.out.println("返回确认日报界面。");
    }
}

private void displayRecord(PlanInformation record) {
    System.out.println("***********************************************************");
    System.out.println("产品批次:" + record.getPlanid());
    System.out.println("产品名称:" + record.getPlanname());
    System.out.println("计划数量:" + record.getPlannumber());
    System.out.println("当前工序:" + record.getProcess());
    System.out.println("下一工序:" + record.getNextprocess());
    System.out.println("操作员:" + record.getOperator());
    System.out.println("接收员:" + record.getRecipient());
    System.out.println("上一道工序转入数量:" + (record.getId() == 1 ? "N/A" : record.getInnumber())); // 第一工序无需录入
    System.out.println("转出总数:" + record.getOutnumber());
    System.out.println("丢失数量:" + record.getMissnumber());
    System.out.println("废品数量:" + record.getBadnumber());
    System.out.println("待检验数量:" + record.getInspectednumber());
    System.out.println("***********************************************************");
}

private void statistics() {
    Scanner scanner = new Scanner(System.in);
    System.out.print("请输入产品批次:");
    String planid = scanner.nextLine();

    PlanInformation foundRecord = null;
    for (PlanInformation record : records) {
        if (record != null && record.getPlanid().equals(planid)) {
            foundRecord = record;
            break;
        }
    }

    if (foundRecord == null) {
        System.out.println("库中没有该产品批次信息。");
        return;
    }

    int completedQuantity = foundRecord.getOutnumber();
    int remainingQuantity = foundRecord.getPlannumber() - completedQuantity;

  
    System.out.println("***********************************************************");
    System.out.println("产品批次:" + foundRecord.getPlanid());
    System.out.println("产品名称:" + foundRecord.getPlanname());
    System.out.println("计划数量:" + foundRecord.getPlannumber());
    System.out.println("完成数量:" + completedQuantity);
    System.out.println("剩余数量:" + remainingQuantity);
    System.out.println("***********************************************************");
}

public static void main(String[] args) {
    PlanManagement planManagement = new PlanManagement();
    planManagement.displayMainMenu();
}

}

标签:开学,String,int,System,println,public,考试,out
From: https://www.cnblogs.com/yangsongduo/p/18438470

相关文章

  • [CKA]CKA预约和考试
    CKA预约和考试一、预约1、登录LinuxFoundationhttps://trainingportal.linuxfoundation.org/learn/dashboard2、首页点"Resume"进行预约3、进入考试准备界面后,按要求分别验证AgreetoGlobalCandidateAgreement(同意全球候选人协议):*点击"ReadNow"进行阅读同意......
  • 基于JavaWeb技术的在线考试系统设计与实现(11551)
     有需要的同学,源代码和配套文档领取,加文章最下方的名片哦一、项目演示项目演示视频二、资料介绍完整源代码(前后端源代码+SQL脚本)配套文档(LW+PPT+开题报告)远程调试控屏包运行三、技术介绍Java语言SSM框架SpringBoot框架Vue框架JSP页面Mysql数据库IDEA/Eclipse开发四、项......
  • java计算机毕业设计青少年编程在线考试系统(开题+程序+论文)
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容研究背景随着信息技术的飞速发展,编程能力已成为衡量青少年综合素质的重要指标之一。在全球化竞争日益激烈的今天,掌握编程技能不仅能够提升学生的逻辑思维、问......
  • 考试改进代码
    importjava.util.Scanner;importjava.util.regex.Pattern;classPlanInformation{privatestaticintidCounter=1;//用于生成唯一的idprivateintid;//日报流水号privateStringplanid;//产品生产批次号privateStringplanname;//产品名称privateString......
  • java入学考试修改版
    以下是java入学测试经过模块化修改的源代码。packagemes;publicclassMesmain{publicstaticvoidmain(String[]args){PlanManagementa=newPlanManagement();a.menu();}}packagemes;publicclassPlanInformation{privateintid;//日报流水表privateString......
  • 【小白必看】2025年PMP备考指南,pmp考试是什么?有没有含金量?值得考吗?(附资料)
    一、PMP考试是什么PMP全称是项目管理专业人士资格认证,它是由PMI(美国项目管理协会)组织和出题的,用于筛选项目管理人才的考试。从本意上理解就跟我们平时的资格认证考试差不多,门槛低,是个入门考试,目前为止选择题,通过率还挺高的。PMP认证在世界上两百多个国家和地区得到高度认可......
  • PMI-ACP认证考试内容将于2025年第一期考试更新
    PMI敏捷管理专业人士(PMI-ACP®)认证即将在2025年迎来引入中国大陆的十周年纪念。十年时间,我们见证了敏捷实践方法普及和敏捷项目管理的“知行合一”,采用敏捷方法的中国企业团队比例的快速持续增长,中国PMI-ACP专业人士的全球占比也从零增长到目前的34%。十年间,为了让PMI-ACP认证的知......
  • 红帽认证考试条件是什么?考试内容一览
    红帽认证是服务器系统厂商Redhat公司推出的一种专业技能认证考试,也是Linux领域被公认的最受欢迎的、认可度最高的认证之一,被划分为低、中、高三个级别。本文将详细介绍红帽认证考试条件和内容。红帽认证考试条件1、红帽认证考试的报考条件红帽认证考试的报考条件是非常宽松的,对考生......
  • RHCE考试具体时间什么时候?红帽认证考试指南
    通常,红帽公司会提前公布考试预约的开放时间和截止时间,考生需要在此时间段内完成预约。下面将为您详细揭秘RHCE考试的具体时间,并提供一份全面的红帽认证考试指南。RHCE考试具体时间RHCE考试并没有固定的考试时间,它采用灵活预约制度。考生可以根据自己的准备情况,在红帽授权......
  • Oracle 19c OCP 认证考试 083 题库(第37题)- 2024年修正版
    【优技教育】Oracle19cOCP083题库(Q37题)-2024年修正版考试科目:1Z0-083考试题量:85道(线下)通过分数:57%以上考试时间:150min(线下)本文为(CUUG原创)整理并解析,转发请注明出处,禁止抄袭及未经注明出处的转载。原文地址:http://www.cuug.com.cn/ocp/083kaoshitiku/38365593598.h......