首页 > 其他分享 >9.17测试代码

9.17测试代码

时间:2023-09-17 22:59:29浏览次数:41  
标签:String 9.17 print System println 测试代码 sc out

package ceshi;

public class WarehouseInformation {
private String itemnode;//编号

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 String getItemnode() {
return itemnode;
}

public void setItemnode(String itemnode) {
this.itemnode = itemnode;
}

public String getSuppliername() {
return suppliername;
}

public void setSuppliername(String suppliername) {
this.suppliername = suppliername;
}

public String getItemname() {
return itemname;
}

public void setItemname(String itemname) {
this.itemname = itemname;
}

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;
}

public WarehouseInformation(String itemnode,String itemname,String suppliername,String warehousingtime,String shipmenttime,String warehousenumber,String warehouseplace,int itemnumber,int outnumber) {
this.itemnode = itemnode;
this.itemname = itemname;
this.itemnumber= itemnumber;
this.outnumber=outnumber;
this.shipmenttime=shipmenttime;
this.suppliername=suppliername;
this.warehousenumber=warehousenumber;
this.warehouseplace=warehouseplace;
this.warehousingtime=warehousingtime;
}
public WarehouseInformation( ) {
this.itemnode = "";
this.itemname = "";
this.itemnumber=0;
this.outnumber=0;
this.shipmenttime="";
this.suppliername= "";
this.warehousenumber="";
this.warehouseplace="";
this.warehousingtime="";
}


}
package ceshi;

import javax.security.auth.callback.LanguageCallback;
import java.util.Scanner;

public class WarehouseManagement {
//static int i=0;
/* static String [] a =new String[5];
static String [] b =new String[5];
static String [] c =new String[5];

static String [] d =new String[5];
static String [] e =new String[5];
static String [] f =new String[5];
static int [] g =new int [5];*/
static WarehouseInformation[] a =new WarehouseInformation[5];
//public static void
//static WarehouseInformation[] si = new WarehouseInformation[5];
public static int menu(){
Scanner sc=new Scanner(System.in);
System.out.println("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+
" 1、 商品入库管理\n"+
" 2、 商品信息修改\n"+
" 3、 商品出库管理\n"+
" 4、 仓库盘点管理\n"+
"****************************************************************\n");
int ch;
System.out.println("请选择");
ch=sc.nextInt();
return ch;
}
public static void luru(int i){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"商品编号:(八位)");
String s;
Scanner sc=new Scanner(System.in);
s= sc.next();

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

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

System.out.print("入库时间(八位):");
String s3;
s3=sc.next();
System.out.print("存放库房号(三位):");
String s4;
s4=sc.next();
System.out.print("存放位置信息(八位):");
String s5;
s5=sc.next();
System.out.print("入库商品数量:");
int s6;
s6=sc.nextInt();
if(s.length()==8&&s3.length()==8&&s4.length()==3&&s5.length()==8){
System.out.println("该商品的入库操作已完成,是否提交(Y/N)");
String s7;
s7=sc.next();
if (s7.equals("Y")) {
a[i].setItemnode(s);
a[i].setItemname(s1);
a[i].setSuppliername(s2);
a[i].setWarehousingtime(s3);
a[i].setWarehouseplace(s5);
a[i].setWarehousenumber(s4);
a[i].setItemnumber(s6);
System.out.println("录入成功");
}
else{
luru(i);
}
}
else{
System.out.print("输入不符合规范");
luru(i);
}
}
public static void xiugai(int i){
System.out.println("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"请输入商品编号\n");
Scanner sc=new Scanner(System.in);
String s1;
s1=sc.next();
for (int j=0;j<i;j++){
if(a[j].getItemnode().equals(s1)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
// Scanner sc=new Scanner(System.in);
int x;
x=sc.nextInt();
if (x!=1&&x!=2&&x!=3&&x!=4&&x!=5&&x!=7&&x!=6){
System.out.println("该选项不存在");
}
if(x==1){
String s2;
s2=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnode(s2);
System.out.println("修改成功");
}

}
if(x==2){
String s3;
s3=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemname(s3);
System.out.println("修改成功");
}
}
if(x==6){
String s4;
s4=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehouseplace(s4);
System.out.println("修改成功");
}
}
if(x==3){
String s5;
s5=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setSuppliername(s5);
System.out.println("修改成功");
}
}
if(x==4){
String s6;
s6=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousingtime(s6);
System.out.println("修改成功");
}
}
if(x==5){
String s7;
s7=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousenumber(s7);
System.out.println("修改成功");
}
}
if(x==7){
int s8;
s8=sc.nextInt();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnumber(s8);
System.out.println("修改成功");
}
}
// return 1;
}
if(j==4){
if(a[j].getItemnode().equals(s1)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("请选择需要修改的信息编号(1-7):");
// Scanner sc=new Scanner(System.in);
int x;
x=sc.nextInt();
if (x!=1&&x!=2&&x!=3&&x!=4&&x!=5&&x!=7&&x!=6){
System.out.println("该选项不存在");
}
if(x==1){
String s2;
s2=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnode(s2);
System.out.println("修改成功");
}

}
if(x==2){
String s3;
s3=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemname(s3);
System.out.println("修改成功");
}
}
if(x==6){
String s4;
s4=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehouseplace(s4);
System.out.println("修改成功");
}
}
if(x==3){
String s5;
s5=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setSuppliername(s5);
System.out.println("修改成功");
}
}
if(x==4){
String s6;
s6=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousingtime(s6);
System.out.println("修改成功");
}
}
if(x==5){
String s7;
s7=sc.next();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setWarehousenumber(s7);
System.out.println("修改成功");
}
}
if(x==7){
int s8;
s8=sc.nextInt();
System.out.println("是否保存修改信息Y/N");
String o;
o=sc.next();
if(o.equals("Y")){
a[j].setItemnumber(s8);
System.out.println("修改成功");
}
}
}
}
}

}
public static void chuku(int i){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"请输入商品编号:");
Scanner sc=new Scanner(System.in);
String s;
s=sc.next();
for (int j=0;j<i;j++){
if(a[j].getItemnode().equals(s)){
System.out.print("***************************************************************\n"+
" 石家庄铁道大学前进22软件开发有限公司\n"+
" 仓库管理系统2022版\n"+
"****************************************************************\n"+"1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("出库时间:");
// Scanner sc=new Scanner(System.in);
String x;
x=sc.next();
System.out.print("出库数量");
int y=sc.nextInt();
if(y>a[j].getItemnumber()){
System.out.println("输入错误");
}
else {
a[j].setItemnumber(a[j].getItemnumber()- y);
}
}
if(j==4){
if(a[j].getItemnode().equals(s)) {
System.out.print("***************************************************************\n" +
" 石家庄铁道大学前进22软件开发有限公司\n" +
" 仓库管理系统2022版\n" +
"****************************************************************\n" + "1.商品编号:");
System.out.println(a[j].getItemnode());
System.out.print("2.商品名称:");
System.out.println(a[j].getItemname());
System.out.print("3.供货商信息:");
System.out.println(a[j].getSuppliername());
System.out.print("4.入库时间:");
System.out.println(a[j].getWarehousingtime());
System.out.print("5.存放仓库号:");
System.out.println(a[j].getWarehousenumber());
System.out.print("6.存放位置信息:");
System.out.println(a[j].getWarehouseplace());
System.out.print("7.入库商品数量:");
System.out.println(a[j].getItemnumber());
System.out.print("出库时间:");
// Scanner sc=new Scanner(System.in);
String x;
x = sc.next();
System.out.print("出库数量");
int y = sc.nextInt();
if (y > a[j].getItemnumber()) {
System.out.println("输入错误");
} else {
a[j].setItemnumber(a[j].getItemnumber() - y);
}
} }
}

}
public static void pandian(int i){
for(int j=0;j<i;j++){
System.out.print("商品编号:");
System.out.print(a[j].getItemnode());
System.out.print("商品名称:");
System.out.print(a[j].getItemname());
System.out.print("库存数量:");
System.out.println(a[j].getItemnumber());
}
}
public static void main(String[] args){
a[0]=new WarehouseInformation();
a[1]=new WarehouseInformation();
a[2]=new WarehouseInformation();
a[3]=new WarehouseInformation();
a[4]=new WarehouseInformation();
int choice;
int i=0;
boolean flag=true;
while(flag){
choice=menu();
switch(choice){
case 1:
luru(i);
i++;
break;
case 2:
xiugai(i);
break;
case 3:
chuku(i);
break;
case 4:
pandian(i);
break;
case 5:
flag=false;
}
}
}
}

标签:String,9.17,print,System,println,测试代码,sc,out
From: https://www.cnblogs.com/xianyu369/p/17710026.html

相关文章

  • 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......
  • 开学测试代码
    importjdk.dynalink.beans.StaticClass;importjava.text.DateFormat;importjava.text.ParseException;importjava.text.SimpleDateFormat;importjava.util.Date;importjava.util.Scanner;publicclassWarehouseManagement{staticWarehouseInformation[]wareho......