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/ ...
随机推荐
- spring boot架构浅谈
首先来说一下什么是spring boot架构 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置 ...
- MS SQL 迁移数据库文件
MS SQL 数据库迁移文件,这里说的不是将数据库迁移到另外一台服务器,只是在服务器不同磁盘目录内做迁移.移动数据库文件的情况大致有下面一些: 1: 事先没有规划好,数据库文件或日志文件增长过快,导致 ...
- Automatic Tuning of Memory Management
4.2.2 Automatic Tuning of Memory Management Two memory management initialization parameters, MEMORY_ ...
- 部署WAR包实时查看Tomcat的状态和日志
在不重启Tomcat的情况下部署WAR包实时输出日志的方法: 注意:以下方式只适合Linux. 一.定位错误 查看Tomcat日志的尾部 tail -n 50 /opt/tomcat8/logs/ca ...
- HDU 3389
对于这道题,我们需要从(A+B)%3==0这式子考虑.对于第一条式子,我们可以知道,只能是奇偶盒子交替转移. 由第二条式子可知,要么是同余为0的A,B之间转移,要么是余数为1,2之间的 转移.后来仔细 ...
- Android 删除新版安卓fragment_main.xml
在新版本号的ADT中,创建androidproject时默认会产生两个xml文件--fragment_main和activity_main. 个人建议把fragment_main这个文件删除掉 1)将 ...
- 监控sql运行时剩余时间
--监控sql执行时剩余时间 你知道正在执行的sql大概须要多长时间么? 你知道正在执行的sql大概完毕了百分之几么? 你知道正在执行的sql大概还要多长时间完毕么? V$SESSION_LONGOP ...
- DexClassLoader和PathClassLoader类载入机制
0x00 在DexClassLoader和PathClassLoader载入Dex流程一文中,我们分析了dex文件怎样形成了DexFile结构体.本文中解说类载入机制,实际上就是生成ClassObje ...
- C语言之基本算法41—字符串匹配问题
//字符串匹配问题 /* =============================================================== 题目:输入两字符串S,T,输出在S中存在但在T ...
- ubuntu下创建第一个rails应用程序
一.创建一个新的应用程序 在控制台输入 > rails new demo create create README.rdoc create Rakefile create config.ru ...