9.4java考试订正

import java.util.Scanner;

public class viovo {
static int number = 5;//五个商品信息
static oppo[] s = new oppo[50];

public static void main(String[] args) {

Scanner ab = new Scanner(System.in);
s[0] = new oppo("", "", "", "", "", "", "", 1, 1);


s[1] = new oppo("", "", "", "", "", "", "", 1, 1);


s[2] = new oppo("", "", "", "", "", "", "", 1, 1);


s[3] = new oppo("", "", "", "", "", "", "", 1, 1);


s[4] = new oppo("", "", "", "", "", "", "", 1, 1);


for (int i = 5; i < s.length; i++) {
s[i] = new oppo();//初始化
}
while (true) {
menu();
int choose = ab.nextInt();
switch (choose) {
case 1:
input();
break;
case 2:
change();
break;
case 3:
output();
break;
case 4:
pan();
break;
}
}

}


public static void menu() {/*主菜单*/
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("***********************************************************");
}


public static void input() {/*商品入库*/
String YN;
int i;
int flag = 0;
Scanner sc = new Scanner(System.in);
String itemno0; //商品编号8
String itemname0; //商品名称
String suppliername0; //供货商名称
String warehousingtime0; //入库时间8
String warehousenumber0; //仓库编号3
String warehouseplace0; //商品具体位置XXXXYYZZ
int itemnumber0; //入库商品的数量。


while (true) {
System.out.println("***********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("商品编号:");
itemno0 = sc.next();
if (itemno0.length() > 8) {
System.out.println("错误,请重新录入");
continue;
}
for (i = 0; i < number; i++) {
if (itemno0.equals(s[i].getItemno())) {
System.out.println("该商品存在");
flag = 1;//是否商品存在标志
break;
}
}


System.out.print("商品名称:");
itemname0 = sc.next();


System.out.print("供货商信息:");
suppliername0 = sc.next();


System.out.print("入库时间:");
warehousingtime0 = sc.next();
if (warehousingtime0.length() > 8) {
System.out.println("录入错误,请重新录入");
continue;
}


System.out.print("存放仓库号:");
warehousenumber0 = sc.next();
if (warehousenumber0.length() > 3) {
System.out.println("录入错误,请重新录入");
continue;
}

System.out.print("存放位置信息:");
warehouseplace0 = sc.next();
if (warehouseplace0.length() > 8) {
System.out.println("录入错误,请重新录入");
continue;
}


System.out.print("入库商品数量:");
itemnumber0 = sc.nextInt();


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

if (flag == 1) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 商品编号:" + itemno0);
System.out.println(" 商品名称:" + itemname0);
System.out.println(" 供货商信息:" + suppliername0);
System.out.println(" 入库时间:" + warehousingtime0);
System.out.println(" 存放仓库号:" + warehousenumber0);
System.out.println(" 存放位置信息:" + warehouseplace0);
System.out.println(" 入库商品数量:" + itemnumber0);
System.out.println("该商品入库操作已完成,是否提交(Y/N)");
YN = sc.next();
if (YN.equals("Y")) {
s[i].setItemno(itemno0);
s[i].setItemname(itemname0);
s[i].setSuppliername(suppliername0);
s[i].setWarehousingtime(warehousingtime0);
s[i].setWarehousenumber(warehousenumber0);
s[i].setWarehouseplace(warehouseplace0);
s[i].setItemnumber(s[i].getItemnumber() + itemnumber0);
break;
} else {
continue;
}
} else {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 商品编号:" + itemno0);
System.out.println(" 商品名称:" + itemname0);
System.out.println(" 供货商信息:" + suppliername0);
System.out.println(" 入库时间:" + warehousingtime0);
System.out.println(" 存放仓库号:" + warehousenumber0);
System.out.println(" 存放位置信息:" + warehouseplace0);
System.out.println(" 入库商品数量:" + itemnumber0);
System.out.println("该商品入库操作已完成,是否提交(Y/N)");
YN = sc.next();
if (YN.equals("Y")) {
s[i].setItemno(itemno0);
s[i].setItemname(itemname0);
s[i].setSuppliername(suppliername0);
s[i].setWarehousingtime(warehousingtime0);
s[i].setWarehousenumber(warehousenumber0);
s[i].setWarehouseplace(warehouseplace0);
s[i].setItemnumber(itemnumber0);
number++;
break;
} else {
continue;
}
}
}
}

public static void change() {
Scanner sc = new Scanner(System.in);
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemno1 = sc.next();
System.out.println("**********************************************************");
for (int j = 0; j < s.length; j++) {
if (itemno1.equals(s[j].getItemno())) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
int choose0 = sc.nextInt();
System.out.println("***********************************************************");
if (choose0 < 1 || choose0 > 7) {
System.out.println("不存在");
break;
} else if (choose0 == 1) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的商品编号:");
String itemno2 = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setItemno(itemno2);
else break;
} else if (choose0 == 2) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的商品名称:");
String itemname2 = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setItemname(itemname2);
else break;
} else if (choose0 == 3) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的供货商信息:");
String suppliername2 = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setSuppliername(suppliername2);
else break;
} else if (choose0 == 4) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的入库时间:");
String warehousingtime2 = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setWarehousingtime(warehousingtime2);
else break;
} else if (choose0 == 5) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的存放仓库号:");
String wps = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String pp = sc.next();
if (pp.equals("Y"))
s[j].setWarehousenumber(wps);
else break;
} else if (choose0 == 6) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 1 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" +s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的存放位置信息:");
String warehouseplace2 = sc.next();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setWarehouseplace(warehouseplace2);
else break;
} else if (choose0 == 7) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.println("请选择需要修改的信息编号(1-7):" + choose0);
System.out.print("请输入修改后的入库商品数量:");
int itemnumber2 = sc.nextInt();
System.out.println("***********************************************************");
System.out.println("Y/N");
String YN1 = sc.next();
if (YN1.equals("Y"))
s[j].setItemnumber(itemnumber2);
else break;
}
} else {
System.out.println("没有找到商品");
continue;
}
}
}

public static void output() {
Scanner sc = new Scanner(System.in);
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemno3 = sc.next();
System.out.println("**********************************************************");
for (int j = 0; j <s.length; j++) {
if (itemno3.equals(s[j].getItemno())) {
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println(" 1、商品编号:" + s[j].getItemno());
System.out.println(" 2、商品名称:" + s[j].getItemname());
System.out.println(" 3、供货商信息:" + s[j].getSuppliername());
System.out.println(" 4、入库时间:" + s[j].getWarehousingtime());
System.out.println(" 5、存放仓库号:" + s[j].getWarehousenumber());
System.out.println(" 6、存放位置信息:" + s[j].getWarehouseplace());
System.out.println(" 7、入库商品数量:" + s[j].getItemnumber());
System.out.print("出库时间:");
String chukutime=sc.next();
System.out.print("出库数量:");
int chukunumber=sc.nextInt();
System.out.println("Y/N");
String YN4= sc.next();
if(YN4.equals("Y")){
s[j].setShipmenttime(chukutime);
s[j].setOutnumber(chukunumber);
break;
}
else continue;
}
else {
System.out.println("库中没有该商品");
continue;
}
}
}
public static void pan(){
Scanner ab=new Scanner(System.in);
System.out.println("**********************************************************");
System.out.println(" 石家庄铁道大学前进22软件开发有限公司");
System.out.println(" 仓库管理系统2022版");
System.out.println("***********************************************************");
for(int i=0;i<number;i++){
System.out.println((i+1)+"商品编号:"+s[i].getItemno()+"商品名称:"+s[i].getItemname()+"库存数量:"+(s[i].getItemnumber()-s[i].getOutnumber()));
}
}

}

 

 

 


public class oppo {
private String itemno; //商品编号8
private String itemname; //商品名称
private String suppliername; //供货商名称
private String warehousingtime; //入库时间8
private String shipmenttime; //出库时间8
private String warehousenumber; //仓库编号3
private String warehouseplace; //商品具体位置XXXXYYZZ
private int itemnumber; //入库商品的数量。
private int outnumber; //表示出库商品的数量
public oppo(){
}
public oppo(String itemno,String itemname,String suppliername,String warehousingtime,String shipmenttime,String warehousenumber,String warehouseplace,int itemnumber,int outnumber)
{this.itemno=itemno;
this.outnumber=outnumber;
this.itemname=itemname;
this.itemno=itemno;
this.warehousenumber=warehousenumber;
this.warehouseplace=warehouseplace;
this.warehousingtime=warehousingtime;
this.suppliername=suppliername;
this.shipmenttime=shipmenttime;
this.itemnumber=itemnumber;
}

public String getItemno() {
return itemno;
}

public void setItemno(String 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;
}
}

 

posted @ 2023-09-06 01:05  beiqu  阅读(5)  评论(0编辑  收藏  举报