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/ ...
随机推荐
- CentOS7下安装docker(Docker系列1)
CentOS7下安装docker 系统要求 为了安装docker,需要准备 64-bit的CentOS 7 删除非官方的Docker包 yum的仓库中有一个很旧的Docker包, 现在Docker官方 ...
- 继续聊WPF——进度条
ProgressBar控件与传统WinForm使用方法完全一样,我们只需关注: Minimum——最小值,默认为0: Maximum——最大值,默认为100. Value——当前值. 关键是它的控 ...
- noip模板复习
自己敲模板还是有很多容易错的地方 写在注释里面了 LCA #include<bits/stdc++.h> #define REP(i, a, b) for(register int i = ...
- 【hihoCoder挑战赛28 A】异或排序
[题目链接]:http://hihocoder.com/problemset/problem/1509 [题意] [题解] 每次找到相邻两个数的二进制形式中; 不同的最高位; 显然S在这一位必然是确定 ...
- 转载 - Pinyin4j的基本用法
原文:http://blog.csdn.net/pathuang68/article/details/6692882 1. 简单介绍 有时候,需要将汉字编程对应的拼音,以方便数据的处理.比如在 ...
- CSU 1506 Problem D: Double Shortest Paths(最小费用最大流)
题意:2个人从1走到n,假设一条路第一次走则是价值di,假设第二次还走这条路则须要价值di+ai,要你输出2个人到达终点的最小价值! 太水了!一条边建2次就OK了.第一次价值为di,第二次为ai+di ...
- UVA11234 Expressions
题目的意思实在是读不懂,又是把栈变成队列什么的.. 只是大体的意思就是把后缀表达式变一下.. 抛开意思,事实上就是依据输入建个树,然后倒序输出.. 拿第一个例子说明:大写代表操作符(+ - × /之类 ...
- cdev_init和register_chrdev区别
--- 01:include/linux/fs.h static inline int register_chrdev(unsigned int major, const char *name, co ...
- Working with SQL Server LocalDB
https://docs.asp.net/en/latest/tutorials/first-mvc-app/working-with-sql.html The ApplicationDbContex ...
- 杂项-SpringEureka:笔记-1
ylbtech-杂项-SpringEureka:笔记-1 1.返回顶部 1. THE SELF PRESERVATION MODE IS TURNED OFF.THIS MAY NOT PROTECT ...