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 超市库存系统的更多相关文章

  1. Java学习笔记7(简易的超市库存管理系统示例)

    用以前学过的知识,可以简单地做一个超市库存管理系统: 定义一个商品类: public class FruitItem { int ID; String name; double price; int ...

  2. 新零售SaaS架构:中央库存系统架构设计

    近年来,越来越多的零售企业大力发展全渠道业务.在销售额增长上,通过线上的小程序.直播.平台渠道等方式,拓展流量变现渠道.在会员增长方面,通过多样的互动方式,全渠道触达消费者,扩大会员规模.而全渠道的库 ...

  3. Java案例:超市库存管理系统

    案例介绍: 模拟真实的库存管理逻辑,完成超市管理系统的日常功能实现,见下图 案例需求分析: 根据案例介绍,我们进行分析,首先需要一个功能菜单,然后输入功能序号后,调用序号对应的功能方法,实现想要的操作 ...

  4. java全栈day07---Eclipse开发工具 超市库存管理系统

    前六天我们都是用Notepad++来编写java程序,通过DOS命令来运行,我们发现这样比较繁琐,那么我们今天就用一个工具Eclipse来开发java Eclipse的下载安装 * A: Eclips ...

  5. javase - 点餐系统

    public class OrderMsg { public static void main(String[] args) throws Exception { /** * 订餐人姓名.选择菜品.送 ...

  6. 零售行业下MongoDB在产品目录系统、库存系统、个性推荐系统中的应用【转载】

    Retail Reference Architecture Part 1: Building a Flexible, Searchable, Low-Latency Product Catalog P ...

  7. Java初学者作业——为某超市设计管理系统,需要在控制台展示系统菜单,菜单之间可以完成跳转。

    返回本章节 返回作业目录 需求说明: 为某超市设计管理系统,需要在控制台展示系统菜单,菜单之间可以完成跳转. 实现思路: 定义mainMenu方法,用于显示主菜单. 主菜单主要负责显示4个选项,分别是 ...

  8. 我是如何一步步编码完成万仓网ERP系统的(十二)库存 1.概述

    https://www.cnblogs.com/smh188/p/11533668.html(我是如何一步步编码完成万仓网ERP系统的(一)系统架构) https://www.cnblogs.com/ ...

  9. 我是如何一步步编码完成万仓网ERP系统的(十四)库存 3.库存日志

    https://www.cnblogs.com/smh188/p/11533668.html(我是如何一步步编码完成万仓网ERP系统的(一)系统架构) https://www.cnblogs.com/ ...

随机推荐

  1. 邓_ Phpcms·二次开发

    PHPCMS V9产品介绍 PHPCMS V9(简称V9)采用PHP5+MYSQL做为技术基础进行开发.V9采用OOP(面向对象)方式进行基础运行框架搭建.模块化开发方式做为功能开发形式.框架易于功能 ...

  2. 【学习笔记】有向无环图上的DP

    手动博客搬家: 本文发表于20180716 10:49:04, 原地址https://blog.csdn.net/suncongbo/article/details/81061378 首先,感谢以下几 ...

  3. HDU 2795 Billboard (线段树+贪心)

    手动博客搬家:本文发表于20170822 21:30:17, 原地址https://blog.csdn.net/suncongbo/article/details/77488127 URL: http ...

  4. LID&LDS 的另外一种算法

    参见:LIS,LDS的另类算法(原) 然后讲讲我的想法:  有结论不上升子序列的个数=最长上升子序列的长度.....至于为什么,在下面讲 上代码: #include <iostream> ...

  5. Spring Cloud-Zuul(十)

    个人理解 在微服务体系体系中 我们会有很多服务.在内部体系中 通过eureka实现服务的自动发现通过ribbon实现服务的调用.但是如果对外部体系提供接口 我们就会涉及到接口的安全性,我们不能可能对每 ...

  6. EXPLAIN sql优化方法(1) 添加索引

    添加索引优化器更高效率地执行语句 假设我们有两个数据表t1和t2,每个有1000行,包含的值从1到1000.下面的查询查找出两个表中值相同的数据行: mysql> SELECT t1.i1, t ...

  7. 洛谷——P1910 L国的战斗之间谍

    https://www.luogu.org/problem/show?pid=1910#sub 题目背景 L国即将与I国发动战争!! 题目描述 俗话说的好:“知己知彼,百战不殆”.L国的指挥官想派出间 ...

  8. 淘宝内部分享:MySQL & MariaDB性能优化

    发表于2015-01-20 16:26| 28875次阅读| 来源mysql.taobao.org| 22 条评论| 作者淘宝数据库团队 MySQL性能优化淘宝数据库 摘要:MySQL是目前使用最多的 ...

  9. Hardware/Firmware/Software的区别

    Hardware: 硬件Firmware: 固化到硬件中的程序Software: 一般指驱动和应用软件,不用固化到硬件中的 ************************************** ...

  10. JSTL函数标签

    tld 文件代码 <?xml version="1.0" encoding="UTF-8" ?> <taglib xmlns="ht ...