首页 > 其他分享 >9.17

9.17

时间:2023-09-17 23:16:24浏览次数:41  
标签:String 9.17 System warehouseInformation println out scanner

package bbb;

 

public class WarehouseInformation {

private String itemnumno;

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( String itemnumno,String itemname,String suppliername,

String warehousingtime,String shipmenttime,String warehousenumber,

String warehouseplace,int itemnumber,int outnumber) {

super();

this.itemnumno=itemnumno;

this.itemname=itemname;

this.suppliername=suppliername;

this.warehousingtime=warehousingtime;

this.shipmenttime=shipmenttime;

this.warehousenumber=warehousenumber;

this.warehouseplace=warehouseplace;

this.itemnumber=itemnumber;

this.outnumber=outnumber;

}

 

public String getItemnumno() {

return itemnumno;

}

 

public void setItemnumno(String itemnumno) {

this.itemnumno = itemnumno;

}

 

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;

}

 

 

package bbb;
import java.util.ArrayList;
import java.util.Scanner;
import bbb.WarehouseInformation;
public class WarehouseManagement {
private WarehouseInformation[] warehouseInformations;

public WarehouseManagement() {
this.warehouseInformations = new WarehouseInformation[5];
}
public static void main(String[] args) {

}
// ArrayList<WarehouseInformation> x = new ArrayList<WarehouseInformation>();
// WarehouseInformation t1=x.warehouse("11111111","陈","铁大","20223987","20230904","111","1111aaaa");
// WarehouseInformation t2=x.warehouse("22222222","田","铁大","20223987","20230904","222","2222bbbb");
// WarehouseInformation t3=x.warehouse("33333333","王","铁大","20223987","20230904","333","3333cccc");
// WarehouseInformation t4=x.warehouse("44444444","李","铁大","20223987","20230904","444","4444dddd");
// WarehouseInformation t5=x.warehouse("55555555","郭","铁大","20223987","20230904","555","5555eeee");

public void run() {
Scanner scanner = new Scanner(System.in);

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("***********************************************************");

System.out.print("请输入数字进行操作:");
int choice = scanner.nextInt();
scanner.nextLine();

switch (choice) {
case 1:
warehouseInboundManagement(scanner);
break;
case 2:
modifyItemInformation(scanner);
break;
case 3:
warehouseOutboundManagement(scanner);
break;
case 4:
warehouseInventoryManagement();
break;
default:
System.out.println("录入错误!");
break;
}
}
}

private void warehouseInboundManagement(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");

WarehouseInformation warehouseInformation = new WarehouseInformation();

System.out.print("商品编号:");
String itemnumno = scanner.nextLine();
warehouseInformation.setItemnumno(itemnumno);

System.out.print("商品名称:");
String itemname = scanner.nextLine();
warehouseInformation.setItemname(itemname);

System.out.print("供货商信息:");
String suppliername = scanner.nextLine();
warehouseInformation.setSuppliername(suppliername);

System.out.print("入库时间:");
String warehousingtime = scanner.nextLine();
warehouseInformation.setWarehousingtime(warehousingtime);

System.out.print("存放仓库号:");
String warehousenumber = scanner.nextLine();
warehouseInformation.setWarehousenumber(warehousenumber);

System.out.print("存放位置信息:");
String warehouseplace = scanner.nextLine();
warehouseInformation.setWarehouseplace(warehouseplace);

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

System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("商品编号:" + warehouseInformation.getItemnumno());
System.out.println("商品名称:" + warehouseInformation.getItemname());
System.out.println("供货商信息:" + warehouseInformation.getSuppliername());
System.out.println("入库时间:" + warehouseInformation.getWarehousingtime());
System.out.println("存放仓库号:" + warehouseInformation.getWarehousenumber());
System.out.println("存放位置信息:" + warehouseInformation.getWarehouseplace());
System.out.println("入库商品数量:" + warehouseInformation.getItemnumber());

System.out.print("该商品入库操作已完成,是否提交(Y/N):");
String submitChoice = scanner.nextLine();

if (submitChoice.equalsIgnoreCase("Y")) {
// 存储商品信息到数组中
for (int i = 0; i < warehouseInformations.length; i++) {
if (warehouseInformations[i] == null) {
warehouseInformations[i] = warehouseInformation;
break;
}
}
}
}

private void modifyItemInformation(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemnumno = scanner.nextLine();

WarehouseInformation targetItem = null;

for (WarehouseInformation warehouseInformation : warehouseInformations) {
if (warehouseInformation != null && warehouseInformation.getItemnumno().equals(itemnumno)) {
targetItem = warehouseInformation;
break;
}
}

if (targetItem == null) {
System.out.println("库中没有该商品!");
return;
}

System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("1、商品编号:" + targetItem.getItemnumno());
System.out.println("2、商品名称:" + targetItem.getItemname());
System.out.println("3、供货商信息:" + targetItem.getSuppliername());
System.out.println("4、入库时间:" + targetItem.getWarehousingtime());
System.out.println("5、存放仓库号:" + targetItem.getWarehousenumber());
System.out.println("6、存放位置信息:" + targetItem.getWarehouseplace());
System.out.println("7、商品数量:" + targetItem.getItemnumber());

System.out.print("请选择需要修改的信息编号(1-7):");
int modifyChoice = scanner.nextInt();
scanner.nextLine();

switch (modifyChoice) {
case 1:
System.out.print("请输入修改后的商品编号:");
String modifiedItemnumno = scanner.nextLine();
targetItem.setItemnumno(modifiedItemnumno);
break;
case 2:
System.out.print("请输入修改后的商品名称:");
String modifiedItemname = scanner.nextLine();
targetItem.setItemname(modifiedItemname);
break;
case 3:
System.out.print("请输入修改后的供货商信息:");
String modifiedSuppliername = scanner.nextLine();
targetItem.setSuppliername(modifiedSuppliername);
break;
case 4:
System.out.print("请输入修改后的入库时间:");
String modifiedWarehousingtime = scanner.nextLine();
targetItem.setWarehousingtime(modifiedWarehousingtime);
break;
case 5:
System.out.print("请输入修改后的存放仓库号:");
String modifiedWarehousenumber = scanner.nextLine();
targetItem.setWarehousenumber(modifiedWarehousenumber);
break;
case 6:
System.out.print("请输入修改后的存放位置信息:");
String modifiedWarehouseplace = scanner.nextLine();
targetItem.setWarehouseplace(modifiedWarehouseplace);
break;
case 7:
System.out.print("请输入修改后的商品数量:");
int modifiedItemnumber = scanner.nextInt();
scanner.nextLine();
targetItem.setItemnumber(modifiedItemnumber);
break;
default:
System.out.println("该选项不存在!");
break;
}

System.out.print("是否保存修改的信息(Y/N):");
String saveChoice = scanner.nextLine();

if (!saveChoice.equalsIgnoreCase("Y")) {
return;
}

System.out.println("修改信息保存成功!");
}

private void warehouseOutboundManagement(Scanner scanner) {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.print("请输入商品编号:");
String itemnumno = scanner.nextLine();

WarehouseInformation targetItem = null;

for (WarehouseInformation warehouseInformation : warehouseInformations) {
if (warehouseInformation != null && warehouseInformation.getItemnumno().equals(itemnumno)) {
targetItem = warehouseInformation;
break;
}
}

if (targetItem == null) {
System.out.println("库中没有该商品!");
return;
}

System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");
System.out.println("1、商品编号:" + targetItem.getItemnumno());
System.out.println("2、商品名称:" + targetItem.getItemname());
System.out.println("3、供货商信息:" + targetItem.getSuppliername());
System.out.println("4、入库时间:" + targetItem.getWarehousingtime());
System.out.println("5、存放仓库号:" + targetItem.getWarehousenumber());
System.out.println("6、存放位置信息:" + targetItem.getWarehouseplace());
System.out.println("7、入库商品数量:" + targetItem.getItemnumber());

System.out.print("出库时间:");
String shipmenttime = scanner.nextLine();
targetItem.setShipmenttime(shipmenttime);

System.out.print("出库数量:");
int outnumber = scanner.nextInt();
scanner.nextLine();
targetItem.setOutnumber(outnumber);

System.out.print("是否保存出库信息(Y/N):");
String saveChoice = scanner.nextLine();

if (!saveChoice.equalsIgnoreCase("Y")) {
return;
}

System.out.println("出库信息保存成功!");
}

private void warehouseInventoryManagement() {
System.out.println("***********************************************************");
System.out.println("石家庄铁道大学前进22软件开发有限公司");
System.out.println("仓库管理系统2022版");
System.out.println("***********************************************************");

for (int i = 0; i < warehouseInformations.length; i++) {
WarehouseInformation warehouseInformation = warehouseInformations[i];
if (warehouseInformation != null) {
System.out.println((i + 1) + "、商品编号:" + warehouseInformation.getItemnumno() + "、商品名称:" + warehouseInformation.getItemname() + "、库存数量:" + warehouseInformation.getItemnumber());
}
}
}
}

 

public void setOutnumber(int outnumber) {

this.outnumber = outnumber;

}

public void show() {

System.out.println(this.itemnumber+this.outnumber);

}

}

标签:String,9.17,System,warehouseInformation,println,out,scanner
From: https://www.cnblogs.com/tianpeisen/p/17710058.html

相关文章

  • 9.17测试代码
    packageceshi;publicclassWarehouseInformation{privateStringitemnode;//编号privateStringitemname;//名字privateStringsuppliername;//供应商privateStringwarehousingtime;//privateStringshipmenttime;privateStringwarehousenumb......
  • 2023 ICPC 网络赛 9.17
    没留够时间准备导致开考的时候耽搁了开场我先写缺省源,抄串了一行,后面才发现。。。然后看了L发现是签到,此时ddw会了A让zsy上去写,我等了一会才把zsy撵下来写L是个失误没沟通好导致我跟ddw都做了D,zsy先后过了DA期间我会了I,ddw会了J,我先上去写,写完没过样例,zsy......
  • 9.17
    生成验证码的Java程序 packagelll;importjava.util.Random;publicclassVerificationCodeGenerator{publicstaticvoidmain(String[]args){StringverificationCode=generateVerificationCode(6);System.out.println("验证码:"+veri......
  • 2023.9.17——每日总结
    学习所花时间(包括上课):9h代码量(行):0行博客量(篇):1篇今天,上午做任务,下午做任务。我了解到的知识点:1.完成任务环境配置;明日计划:1.上课;2.继续完成我的任务;......
  • 9.17
    packagefrist1;importjava.awt.*;importjavax.swing.*;importjavax.swing.JFrame;//使窗体位于屏幕中间publicclassDemo1{publicstaticvoidmain(String[]args){JFramewindow1=newJFrame();//java提供的JFrame类的实例是一个底层容器,即通......
  • 9.17
    importjava.util.Scanner;classWarehouseInformation{privateStringitemNumber;privateStringitemName;privateStringsupplierName;privateStringwarehousingTime;privateStringshipmentTime;privateStringwarehouseNumber;privat......
  • 畅购商城学习日志9.17
    org.springframework.beans.factory.BeanDefinitionStoreException:Failedtoparseconfigurationclass[com.changgou.GoodsApplication];nestedexceptionisorg.springframework.context.annotation.ConflictingBeanDefinitionException:Annotation-specifiedbeann......
  • 9.17课堂测试更改代码
    importjava.util.ArrayList;importjava.util.Scanner;publicclassmainFrame{publicstaticvoidmain(String[]args){ArrayList<WarehouseInformation>array=newArrayList<WarehouseInformation>();while(true){Syste......
  • 测试重写9.17
    packageqiyexinxi;importjava.util.Scanner;publicclassqiyexinxi{ //定义WarehouseInformation类publicstaticclassWarehouseInformation{privateStringitemno;//商品编号privateStringitemname;//商品名称privateStringsuppliername;//供货商名称pri......
  • 登录界面9.17
    packagetest;importjavax.swing.*;importjava.awt.*;publicclasstest2{//创造字符串储存账号publicstaticStringuname[]=newString[100];//创造字符串储存密码publicstaticStringupass[]=newString[100];//记录当前坐标publicstaticintflag_user......