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/ ...
随机推荐
- Firefox配置Fiddler
Fiddler: Toos->Telerik Fiddler Options->HTTPS->Capture HTTPS CONNECTs Toos->Telerik Fidd ...
- 洛谷 P2764 LibreOJ 6002 最小路径覆盖问题
题目描述 «问题描述: 给定有向图G=(V,E).设P 是G 的一个简单路(顶点不相交)的集合.如果V 中每个顶点恰好在P 的一条路上,则称P是G 的一个路径覆盖.P 中路径可以从V 的任何一个顶点开 ...
- 【ACM】poj_2080_Calendar_201307311043
CalendarTime Limit: 1000MS Memory Limit: 30000K Total Submissions: 9787 Accepted: 3677 Description ...
- 为Android开发人员定制的搜索引擎
我在谷歌上定制了一个专门针对Android开发人员的搜索引擎.载入慢的童鞋考虑FanQiang吧,作为技术人员使用Google才是王道. 在此推荐给大家:cx=01590883735180208228 ...
- GitLab 7.5.3 CentOS7安装和SMTP配置
CentOS 7安装GitLab还是比較简单的,依照官方文档的提示一步一步操作下来.就一个地方须要改动. 參考:GitLab安装说明 在安装好以后,执行 gitlab-ctl reconfigure ...
- Codeforces444A_DZY Loves Physics
DZY Loves Physics time limit per test 1 second memory limit per test 256 megabytes input standard in ...
- 【网络协议】ICMP协议、Ping、Traceroute
ICMP协议 ICMP常常被觉得是IP层的一个组成部分,它是网络层的一个协议.它传递差错报文以及其它须要注意的信息.ICMP报文通常被IP层或更高层(TCP.UDP等)使用,它是在IP数据报内 ...
- Linux正則表達式-定位元字符
有两个元字符用于指定字符串出如今行首或行末.脱字符(^)是指示開始的单字符正則表達式.美元符号($)是指示行结尾的单字符的正則表達式.这些通常称为"定位符",由于它们将匹配限定在特 ...
- c++迭代器失效问题
参考两篇文章:https://blog.csdn.net/skyroben/article/details/70877008 https://lichanghao.github.io/2016/08/ ...
- hdoj-1004-Let the Balloon Rise(水题)
Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Oth ...