日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 >

javase 超市库存系统

發布時間:2025/7/25 78 豆豆
生活随笔 收集整理的這篇文章主要介紹了 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);}} }

?

轉載于:https://www.cnblogs.com/hankai2735/p/9046903.html

總結

以上是生活随笔為你收集整理的javase 超市库存系统的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。