首页 > 其他分享 >9.13

9.13

时间:2023-09-13 22:22:44浏览次数:32  
标签:code scanner String 9.13 System println out

上午学习英语,背了会儿单词,准备四级考试。下午简单学习了会儿Java,完成了Java开学测试的重写

package xinde;

 

public class WarehouseInformation {

private String code;

private String name;

private String supplier;

private String time;

private String warehouseNumber;

private String location;

private int quantity;

 

public WarehouseInformation(String code, String name, String supplier, String time, String warehouseNumber, String location, int quantity) {

this.code = code;

this.name = name;

this.supplier = supplier;

this.time = time;

this.warehouseNumber = warehouseNumber;

this.location = location;

this.quantity = quantity;

}

 

}

 

package xinde;

import java.util.Scanner;

 

 

public class WarehouseManagement {

private static WarehouseInformation[] warehouse = new WarehouseInformation[100]; // 假设最多存储100条仓库信息

private static int warehouseCount = 0; // 当前仓库信息数量

 

public static void main(String[] args) {

mainFrame();

}

 

public static void mainFrame() {

System.out.println("欢迎使用仓库管理系统!");

System.out.println("1. 商品入库");

System.out.println("2. 商品修改");

System.out.println("3. 商品出库");

System.out.println("4. 统计商品库存数量");

System.out.println("0. 退出系统");

 

Scanner scanner = new Scanner(System.in);

int choice = scanner.nextInt();

 

switch (choice) {

case 1:

goodsWarehousing();

break;

case 2:

modifyWarehouse();

break;

case 3:

outboundWarehouse();

break;

case 4:

countGoods();

break;

case 0:

System.out.println("感谢使用仓库管理系统,再见!");

System.exit(0);

break;

default:

System.out.println("输入有误,请重新输入!");

mainFrame();

break;

}

}

 

public static void goodsWarehousing() {

Scanner scanner = new Scanner(System.in);

 

System.out.println("请输入商品编号:");

String code = scanner.nextLine();

 

// 判断商品编号是否正确

// ...

 

System.out.println("请输入商品名称:");

String name = scanner.nextLine();

 

System.out.println("请输入供货商信息:");

String supplier = scanner.nextLine();

 

System.out.println("请输入入库时间:");

String time = scanner.nextLine();

 

System.out.println("请输入存放仓库号:");

String warehouseNumber = scanner.nextLine();

 

System.out.println("请输入存放位置信息:");

String location = scanner.nextLine();

 

System.out.println("请输入入库数量:");

int quantity = scanner.nextInt();

 

if (quantity <= 0) {

System.out.println("入库数量需大于0,请重新输入!");

goodsWarehousing();

} else {

System.out.println("是否确认入库(Y/N)?");

String confirm = scanner.next();

 

if (confirm.equalsIgnoreCase("Y")) {

addData(code, name, supplier, time, warehouseNumber, location, quantity);

System.out.println("商品入库成功!");

} else {

System.out.println("商品入库取消!");

}

 

mainFrame();

}

}

 

public static void modifyWarehouse() {

Scanner scanner = new Scanner(System.in);

 

System.out.println("请输入商品编号:");

String code = scanner.nextLine();

 

// 判断商品是否存在

// ...

 

// 显示商品信息

// ...

 

System.out.println("请选择需要修改的信息编号(1-7):");

int choice = scanner.nextInt();

 

switch (choice) {

case 1:

System.out.println("请输入新的商品编码:");

String newCode = scanner.next();

modifyData(code, choice, newCode);

break;

case 2:

System.out.println("请输入新的商品名称:");

String newName = scanner.next();

modifyData(code, choice, newName);

break;

// ...

case 7:

System.out.println("请输入新的入库数量:");

int newQuantity = scanner.nextInt();

modifyData(code, choice, newQuantity);

break;

default:

System.out.println("输入有误,请重新输入!");

modifyWarehouse();

break;

}

 

System.out.println("商品修改成功!");

mainFrame();

}

 

public static void outboundWarehouse() {

Scanner scanner = new Scanner(System.in);

 

System.out.println("请输入商品编号:");

String code = scanner.nextLine();

 

// 判断商品是否存在

// ...

 

// 显示商品信息

// ...

 

// 计算库存数量

// ...

 

System.out.println("请输入出库数量:");

int quantity = scanner.nextInt();

 

// 判断出库数量是否小于库存数量

// ...

 

System.out.println("是否确认出库(Y/N)?");

String confirm = scanner.next();

 

if (confirm.equalsIgnoreCase("Y")) {

modifyData(code, 7, quantity);

System.out.println("商品出库成功!");

} else {

System.out.println("商品出库取消!");

}

 

mainFrame();

}

 

public static void countGoods() {

// 按照商品编号分组统计库存数量

// ...

 

// 显示统计结果

// ...

 

mainFrame();

}

 

public static void addData(String code, String name, String supplier, String time, String warehouseNumber, String location, int quantity) {

warehouse[warehouseCount] = new WarehouseInformation(code, name, supplier, time, warehouseNumber, location, quantity);

warehouseCount++;

}

 

public static void modifyData(String code, int choice, Object newValue) {

// 根据商品编号查找对应的仓库信息

// ...

 

// 修改对应的信息

// ...

}

 

}

标签:code,scanner,String,9.13,System,println,out
From: https://www.cnblogs.com/jais/p/17700952.html

相关文章

  • 9.13日
    今天早上进行了英语提高的学习,我学习了五个短语和13个不易区分的单词辨别,还有两个语法难点及两长难句的分解。下午简单学习了java程序运行窗口并巩固学习了数据结构与算法的插入排序。  packagerunoob;/** *插入排序 */publicclassInsertionSort{  //......
  • 9.13
    d同学爱上了隔壁班的学霸美女学姐L只因,可是L只因是一个特立独行的计算机算法大佬,她在说话的时候会将所有的数字转换为十六进制表示,为了鉴定d同学是不是渣男,L只因想要考验他一下,于是向他提出要求:如果你能将我说的数字转化成二进制数存进电脑里,那我就接受你的追求。这可把d同学高兴......
  • 2023.9.13
    今天上午学习了英语的新语法。下午从新写了java的课前测试,通过在写一遍感触更加的深刻,通过仔细读题,学习到合理使用函数方法能够增加代码的利用率,正确的命名也可以增加文件的可读性,可以提高自己的代码水平。经过对原来代码的进一步理解和修改,可以修改不完美的地方。学习了普通swit......
  • 9.13
    1.把之前剩下的一个动手动脑问题解决2.复习了一下javawebz的前端内容,写了一个登录界面,可随机生成验证码,里面有好多之前没学的专有名词,都按个学习了一下,并标注了。明天再复习一下3.今天上了三节英语课,要开始学听力了,从来没学过听力,英语基础也不好要开始着手学习了。......
  • 9.13完成ppt动手动脑问题
    枚举类型问题:privateenumSize{SMALL,MEDIUM,LARGE}publicstaticvoidmain(String[]args){Sizes=Size.SMALL;Sizet=Size.valueOf("SMALL");System.out.println(t.valueOf("SMALL"));for(Sizevalue:Size.values()){System.out.println(v......
  • 9.13
    今天初次接触MySQL也就是数据库但是还没有实际连接感觉应该不会很简单 and安装了数据库及软件之后电脑变得卡卡的 mad ......
  • 每日总结9.13
    今天总结一下前几天学习的成果,完成了大数据集群的一些配置,在虚拟机中创建了大数据集群其中有三台虚拟机,完成了配置Finashell的连接hadoop,yarn,hive,mysql以及java环境的配置,这几天完成大数据了的基本配置未来的时间将继续学习大数据的增删改查。......
  • 9.13 每日总结
    今天主要着重为hbase增删改查编写一个web的界面,借此复习一下之前javaweb的相关知识,使用tomcat和servlet编写一个web界面,只需要完成hbase的数据操作即可;但是由于连接到虚拟机的这个连接是一个重量级的连接,往往会相对比较慢,故可能有一点小问题,不过问题不大。......
  • 23.9.13
    两数相加:(Java图形化界面)//Anadditionprogramimportjavax.swing.JOptionPane;//importclassJOptionPanepublicclassAddition{publicstaticvoidmain(String[]args){StringfirstNumber,//firststringenteredbyusersecondNumber;......
  • 9.13
    因为暑假电脑的格式化今天重新配置了maven和tomcat,但是idea每次启动都要重新配置maven,全局设置也没用,难受,然后就装了下vue ......