javase 超市库存系统
package com.oracle.demo01; import java.util.ArrayList;
import java.util.Scanner; public class Demo01 {
public static void main(String[] args) {
System.out.println("=========================欢迎光临 oracle 超市======================");
System.out.println("1:货物清单 2:添加新货物 3:删除货物 4:修改货物");
System.out.println("5:退出系统");
System.out.println("请您输入要操作的功能序号");
System.out.println("--------------");
while(true){
System.out.println("1:货物清单 2:添加新货物 3:删除货物 4:修改货物");
System.out.println("5:退出系统");
System.out.println("请您输入要操作的功能序号");
Scanner sc = new Scanner(System.in);
int num = sc.nextInt();
switch (num) {
case 1:
f1();
break;
case 2:
f2();
break;
case 3:
f3();
break;
case 4:
f4();
break;
case 5:
return;
default:
System.out.println("您输入的有误");
break;
}
} } public static void f1() {
ArrayList<chaoshi> arr = new ArrayList<chaoshi>();
chaoshi c1 = new chaoshi();
c1.spbh = 9001;
c1.spm = "少林寺酥饼核桃";
c1.jiage = 120.0;
arr.add(c1);
chaoshi c2 = new chaoshi();
c2.spbh = 9002;
c2.spm = "尚康杂粮牡丹饼";
c2.jiage = 20.0;
arr.add(c2);
chaoshi c3 = new chaoshi();
c3.spbh = 9003;
c3.spm = "新疆原产哈密瓜";
c3.jiage = 7.0;
arr.add(c3);
System.out.println("商品编号" + "\t" + "商品名称" + "\t" + "\t" + "商品单价");
for (int i = 0; i < arr.size(); i++) {
System.out.println(arr.get(i).spbh + "\t" + arr.get(i).spm + "\t" + arr.get(i).jiage);
}
} public static void f2() {
ArrayList<chaoshi> arr = new ArrayList<chaoshi>();
chaoshi c4 = new chaoshi();
System.out.println("输入新水果的名称:");
Scanner mz = new Scanner(System.in);
String sg = mz.next();
c4.spm = sg;
System.out.println("输入新水果的编号:");
int sg1 = mz.nextInt();
c4.spbh = sg1;
System.out.println("输入新水果的价格:");
int sg2 = mz.nextInt();
c4.jiage = sg2;
arr.add(c4);
chaoshi c1 = new chaoshi();
c1.spbh = 9001;
c1.spm = "少林寺酥饼核桃";
c1.jiage = 120.0;
arr.add(c1);
chaoshi c2 = new chaoshi();
c2.spbh = 9002;
c2.spm = "尚康杂粮牡丹饼";
c2.jiage = 20.0;
arr.add(c2);
chaoshi c3 = new chaoshi();
c3.spbh = 9003;
c3.spm = "新疆原产哈密瓜";
c3.jiage = 7.0;
arr.add(c3);
System.out.println("商品编号" + "\t" + "商品名称" + "\t" + "\t" + "商品单价");
for (int i = 0; i < arr.size(); i++) {
System.out.println(arr.get(i).spbh + "\t" + arr.get(i).spm + "\t" + arr.get(i).jiage);
}
} public static void f3() {
System.out.println("输入您要删除的商品编号");
Scanner sc = new Scanner(System.in);
int sc1 = sc.nextInt();
ArrayList<chaoshi> arr = new ArrayList<chaoshi>();
chaoshi c1 = new chaoshi();
c1.spbh = 9001;
c1.spm = "少林寺酥饼核桃";
c1.jiage = 120.0;
arr.add(c1);
chaoshi c2 = new chaoshi();
c2.spbh = 9002;
c2.spm = "尚康杂粮牡丹饼";
c2.jiage = 20.0;
arr.add(c2);
chaoshi c3 = new chaoshi();
c3.spbh = 9003;
c3.spm = "新疆原产哈密瓜";
c3.jiage = 7.0;
arr.add(c3);
if (sc1 == 9001) {
arr.remove(0);
}
if (sc1 == 9002) {
arr.remove(1);
}
if (sc1 == 9003) {
arr.remove(2);
}
System.out.println("商品编号" + "\t" + "商品名称" + "\t" + "\t" + "商品单价");
for (int i = 0; i < arr.size(); i++) {
System.out.println(arr.get(i).spbh + "\t" + arr.get(i).spm + "\t" + arr.get(i).jiage);
}
} public static void f4() {
ArrayList<chaoshi> arr = new ArrayList<chaoshi>();
chaoshi c1 = new chaoshi();
c1.spbh = 9001;
c1.spm = "少林寺酥饼核桃";
c1.jiage = 120.0;
arr.add(c1);
chaoshi c2 = new chaoshi();
c2.spbh = 9002;
c2.spm = "尚康杂粮牡丹饼";
c2.jiage = 20.0;
arr.add(c2);
chaoshi c3 = new chaoshi();
c3.spbh = 9003;
c3.spm = "新疆原产哈密瓜";
c3.jiage = 7.0;
arr.add(c3);
System.out.println("输入您要修改的商品编码:");
Scanner xg = new Scanner(System.in);
int g1 = xg.nextInt();
System.out.println("输入新的商品编码");
int g2 = xg.nextInt();
System.out.println("输入新的水果名称");
String g3 = xg.next();
System.out.println("输入新的水果价格");
int g4 = xg.nextInt();
if (g1 == 9001) {
c1.spbh = g2;
c1.spm = g3;
c1.jiage = g4;
}
if (g1 == 9002) {
c2.spbh = g2;
c2.spm = g3;
c2.jiage = g4;
}
if (g1 == 9003) {
c3.spbh = g2;
c3.spm = g3;
c3.jiage = g4;
}
System.out.println("商品编号" + "\t" + "商品名称" + "\t" + "\t" + "商品单价");
for (int i = 0; i < arr.size(); i++) {
System.out.println(arr.get(i).spbh + "\t" + arr.get(i).spm + "\t" + arr.get(i).jiage);
}
}
}
javase 超市库存系统的更多相关文章
- Java学习笔记7(简易的超市库存管理系统示例)
用以前学过的知识,可以简单地做一个超市库存管理系统: 定义一个商品类: public class FruitItem { int ID; String name; double price; int ...
- 新零售SaaS架构:中央库存系统架构设计
近年来,越来越多的零售企业大力发展全渠道业务.在销售额增长上,通过线上的小程序.直播.平台渠道等方式,拓展流量变现渠道.在会员增长方面,通过多样的互动方式,全渠道触达消费者,扩大会员规模.而全渠道的库 ...
- Java案例:超市库存管理系统
案例介绍: 模拟真实的库存管理逻辑,完成超市管理系统的日常功能实现,见下图 案例需求分析: 根据案例介绍,我们进行分析,首先需要一个功能菜单,然后输入功能序号后,调用序号对应的功能方法,实现想要的操作 ...
- java全栈day07---Eclipse开发工具 超市库存管理系统
前六天我们都是用Notepad++来编写java程序,通过DOS命令来运行,我们发现这样比较繁琐,那么我们今天就用一个工具Eclipse来开发java Eclipse的下载安装 * A: Eclips ...
- javase - 点餐系统
public class OrderMsg { public static void main(String[] args) throws Exception { /** * 订餐人姓名.选择菜品.送 ...
- 零售行业下MongoDB在产品目录系统、库存系统、个性推荐系统中的应用【转载】
Retail Reference Architecture Part 1: Building a Flexible, Searchable, Low-Latency Product Catalog P ...
- Java初学者作业——为某超市设计管理系统,需要在控制台展示系统菜单,菜单之间可以完成跳转。
返回本章节 返回作业目录 需求说明: 为某超市设计管理系统,需要在控制台展示系统菜单,菜单之间可以完成跳转. 实现思路: 定义mainMenu方法,用于显示主菜单. 主菜单主要负责显示4个选项,分别是 ...
- 我是如何一步步编码完成万仓网ERP系统的(十二)库存 1.概述
https://www.cnblogs.com/smh188/p/11533668.html(我是如何一步步编码完成万仓网ERP系统的(一)系统架构) https://www.cnblogs.com/ ...
- 我是如何一步步编码完成万仓网ERP系统的(十四)库存 3.库存日志
https://www.cnblogs.com/smh188/p/11533668.html(我是如何一步步编码完成万仓网ERP系统的(一)系统架构) https://www.cnblogs.com/ ...
随机推荐
- 洛谷 P1640 BZOJ 1854 [SCOI2010]连续攻击游戏
题目描述 lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示.当他使用某种装备时,他只能使用该装备的某一个属性.并且每种装备 ...
- ExtJs之Ext.view.View
要注意MODEL的定义和实例化的代码,注释掉的是老式的不兼容4.0以上的.而下面的定义才是新推荐的. 我网上可是查的了.是书上的代码老了. <!DOCTYPE html> <html ...
- 【ACM】hdu_zs1_1003_放大的X _201307271557
放大的X Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)Total Submissio ...
- [bzoj1369][Baltic2003]Gem_树形dp_结论题
Gem bzoj-1369 Baltic-2003 题目大意:给你一棵树,让你往节点上添自然数,使得任意相邻节点的数不同且使得权值最小. 注释:n为结点个数,$1\le n\le 10^3$. 想法: ...
- javascript的函数、创建对象、封装、属性和方法、继承
转自原文javascript的函数.创建对象.封装.属性和方法.继承 一,function 从一开始接触到js就感觉好灵活,每个人的写法都不一样,比如一个function就有N种写法 如:functi ...
- iOS_网络请求_代理方式
#pragma mark - 网络请求代理方式(异步) - (IBAction)DelegateButtonDidClicked:(UIButton *)sender { // 1.拼接 urlStr ...
- POJ 1984
我做过的最棘手的一道题了,不是因为难,难就是不懂,而是因为明明思路对了,却调了很久程序没发现自己哪错了.....就连样例都不过 操,别人的代码::::::::::::::::::::::::::::. ...
- MVVM设计模式基础知识--ICommand接口
命令是 Windows Presentation Foundation (WPF) 中的输入机制,它提供的输入处理比设备输入具有更高的语义级别. 命令有若干用途: 第一个用途是将语义以及调用命令的对象 ...
- 【JEECG技术博文】Local storage & easyui extensions
1. Local storage背景 cookie弊端:同域内http请求都会带cookie,添加带宽和流量:有个数和限制大小(约4K). 在HTML5中,本地存储是一个window的属性.包含loc ...
- Tomcat启动时项目反复载入,导致资源初始化两次的问题
近期在项目开发測试的时候,发现Tomcat启动时项目反复载入,导致资源初始化两次的问题 导致该问题的解决办法: 例如以下图:在Eclipse中将Server Locations设置为"Us ...