1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢(xún)
      選擇下列產(chǎn)品馬上在線(xiàn)溝通
      服務(wù)時(shí)間:8:30-17:00
      你可能遇到了下面的問(wèn)題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
      刪除商品Java代碼 java刪除代碼怎么寫(xiě)

      求一段java代碼,關(guān)與刪除表關(guān)系之類(lèi)的。。

      我只提供思路,代碼就不用了吧:先通過(guò)設(shè)備id找到模組,遍歷模組,通過(guò)模組id刪除中間表關(guān)系,再刪除模組,最后刪除設(shè)備(你應(yīng)該用的是JDBC吧,用hibernate就簡(jiǎn)單多啦)

      創(chuàng)新互聯(lián)主要從事成都網(wǎng)站制作、成都做網(wǎng)站、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)西城,10余年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專(zhuān)業(yè),歡迎來(lái)電咨詢(xún)建站服務(wù):18980820575

      Java使用字符串生成器來(lái)保存購(gòu)物車(chē)中的商品信息,并能實(shí)現(xiàn)商品信息的添加、刪除以及修改等功能

      public?class?Cart?{

      public?StringBuilder?data;

      public?float?total;

      public?Cart(){

      data=new?StringBuilder();

      }

      public?void?buy(Goods?g){

      g.gtotal=g.gnum*g.gprice;

      total=total+g.gtotal;

      data.append("[");

      data.append(g.gname+"|");

      data.append(g.gprice+"|");

      data.append(g.gnum+"|");??//還是豎線(xiàn)看著方便

      data.append(g.gtotal);

      data.append("]");

      }

      public?void?delete(Goods?g){

      int?s=data.indexOf(g.gname);

      int?e=data.indexOf("]",?s);

      data.delete(s-1,?e+1);

      total=total-g.gtotal;??//刪除商品?,需要修改總額

      }

      public?void?update(Goods?g){

      data.replace(3,?10,?"["+g.gname+"|"+g.gprice+"|"+g.gnum+"|"+g.gtotal);

      }

      public?void?show(){

      System.out.print("總計(jì)金額:"?+?total?+?"????")?;

      System.out.println(data);

      }

      }

      //Excute類(lèi)里有點(diǎn)小錯(cuò)誤,

      //總覺(jué)得update方法?不對(duì)頭,你想怎么做?

      求一個(gè)JAVA里用map集合寫(xiě)一個(gè)購(gòu)物車(chē)的代碼,購(gòu)物車(chē)實(shí)現(xiàn)商品的添加,刪除,查詢(xún)和結(jié)算,寫(xiě)了半天沒(méi)

      建一個(gè)靜態(tài)的Map集合 做購(gòu)物車(chē)的集合

      key值 放商品的ID value 放 商品對(duì)象.

      對(duì)map 增刪改查就好了.. 結(jié)算完了 清空map

      想用JAVA敲一段商品管理員的程序,有登錄賬號(hào)和密碼,然后可以添加和刪除商品的功能?

      項(xiàng)目:完成一個(gè)電商系統(tǒng)的商品模塊功能,商品類(lèi)包含以下屬性:商品ID, 商品名,類(lèi)別名,單價(jià),庫(kù)存量,產(chǎn)地,計(jì)量單位等信息,要求實(shí)現(xiàn)商品管理功能以及管理員功能,具體如下:

      1.管路員登錄(賬號(hào)密碼固定admin/admin)

      2.修改管理員密碼

      3.商品添加

      4.商品列表

      5.查詢(xún)指定id商品

      6.根據(jù)商品id刪除商品

      7.根據(jù)id修改商品價(jià)格

      8.根據(jù)id修改指定商品庫(kù)存

      9.根據(jù)商品類(lèi)別查詢(xún)所有商品

      10.查詢(xún)指定價(jià)格區(qū)間的商品信息

      根據(jù)項(xiàng)目要求,我們首先分析題目,知道此項(xiàng)目至少四個(gè)類(lèi):管理員類(lèi)、商品類(lèi)、系統(tǒng)類(lèi)、測(cè)試類(lèi)。

      由于我們決定對(duì)此系統(tǒng)進(jìn)行優(yōu)化,要求能夠?qū)?shù)據(jù)進(jìn)行保存,所以我們用流的相關(guān)知識(shí),將數(shù)據(jù)寫(xiě)入已經(jīng)創(chuàng)建好的文檔中,使其自動(dòng)讀寫(xiě),以便管理,三個(gè)文檔分別用于保存商品信息、id、user。

      Java求解答

      import?java.util.Scanner;

      import?java.util.Vector;

      /*

      *只寫(xiě)了1,2,5功能,其他不想寫(xiě)了

      */

      public?class?GoodsArrays?{

      private?static?VectorGoods?vec?=?new?VectorGoods();

      public?static?void?main(String[]?args)?{

      GoodsArrays?ga=new?GoodsArrays();

      ga.run();

      }

      public?void?run()?{

      info();

      }

      public?void?info()?{

      System.out.println("**********商品管理**********");

      while?(true)?{

      System.out.println("請(qǐng)選擇你要操作的業(yè)務(wù)");

      System.out.println("1.進(jìn)貨");

      System.out.println("2.查詢(xún)商品信息");

      System.out.println("3.修改商品信息");

      System.out.println("4.刪除商品信息");

      System.out.println("5.退出");

      Scanner?sc=new?Scanner(System.in);

      System.out.println("請(qǐng)輸入操作:");

      int?op=sc.nextInt();

      switch?(op)?{

      case?1:

      inGoods();

      break;

      case?2:

      searchGoods();

      break;

      case?5:

      System.out.println("退出系統(tǒng)");

      System.exit(0);

      break;

      default:

      break;

      }

      }

      }

      //?進(jìn)貨

      public?void?inGoods()?{

      try?{

      Scanner?sc?=?new?Scanner(System.in);

      System.out.println("請(qǐng)輸入條碼:");

      int?gid?=?sc.nextInt();

      System.out.println("請(qǐng)輸入商品類(lèi)型:");

      String?cname?=?sc.next();

      System.out.println("請(qǐng)輸入商品名稱(chēng):");

      String?gname?=?sc.next();

      System.out.println("請(qǐng)輸入報(bào)警數(shù):");

      int?minNumber?=?sc.nextInt();

      System.out.println("請(qǐng)輸入市場(chǎng)價(jià):");

      double?salePrice?=?sc.nextDouble();

      System.out.println("請(qǐng)輸入會(huì)員價(jià):");

      double?vipPrice?=?sc.nextDouble();

      System.out.println("請(qǐng)輸入庫(kù)存量:");

      int?amount?=?sc.nextInt();

      vec.add(new?Goods(gid,?cname,?gname,?minNumber,?salePrice,?vipPrice,?amount));

      }?catch?(Exception?e)?{

      e.printStackTrace();

      }

      }

      //?查詢(xún)

      public?void?searchGoods()?{

      Scanner?sc?=?new?Scanner(System.in);

      System.out.println("------查詢(xún)商品------");

      System.out.println("請(qǐng)選擇查詢(xún)類(lèi)型");

      System.out.println("a.查詢(xún)所有商品:");

      System.out.println("b.查詢(xún)單個(gè)商品:");

      String?op?=?sc.next();

      if?(op.equalsIgnoreCase("a"))?{

      for?(Goods?goods?:?vec)?{

      System.out.println(goods);

      }

      }?else?if?(op.equalsIgnoreCase("b"))?{

      System.out.println("請(qǐng)輸入商品編號(hào):");

      int?gid?=?sc.nextInt();

      boolean?findIndex?=?true;

      for?(Goods?goods?:?vec)?{

      int?id?=?goods.getGid();

      if?(id?==?gid)?{

      System.out.println(goods);

      break;

      }?else?{

      findIndex?=?false;

      }

      }

      if?(findIndex?==?false)?{

      System.out.println("查詢(xún)的商品不存在");

      }

      }

      }

      }

      //實(shí)體類(lèi)Goods

      public?class?Goods?{

      private?int?gid;

      private?String?cname;

      private?String?gname;

      private?int?minNumber;

      private?double?salePrice;

      private?double?vipPrice;

      private?int?amount;

      //重寫(xiě)Goods?toString()方法,用于顯示信息

      @Override

      public?String?toString()?{

      System.out.println("商品信息如下:");

      return?"[條碼:"?+?gid?+?",商品類(lèi)型:"?+?cname?+?",商品名稱(chēng):"?+?gname?+?",報(bào)警數(shù):"?+?minNumber

      +?",市場(chǎng)價(jià):"?+?salePrice?+?",會(huì)員價(jià):"?+?vipPrice?+?",庫(kù)存量:"?+?amount?+?"]";

      }

      //Goods構(gòu)造函數(shù),

      public?Goods(int?gid,?String?cname,?String?gname,?int?minNumber,?double?salePrice,?double?vipPrice,?int?amount)?{

      super();

      this.gid?=?gid;

      this.cname?=?cname;

      this.gname?=?gname;

      this.minNumber?=?minNumber;

      this.salePrice?=?salePrice;

      this.vipPrice?=?vipPrice;

      this.amount?=?amount;

      }

      public?int?getGid()?{

      return?gid;

      }

      public?void?setGid(int?gid)?{

      this.gid?=?gid;

      }

      public?String?getCname()?{

      return?cname;

      }

      public?void?setCname(String?cname)?{

      this.cname?=?cname;

      }

      public?String?getGname()?{

      return?gname;

      }

      public?void?setGname(String?gname)?{

      this.gname?=?gname;

      }

      public?int?getMinNumber()?{

      return?minNumber;

      }

      public?void?setMinNumber(int?minNumber)?{

      this.minNumber?=?minNumber;

      }

      public?double?getSalePrice()?{

      return?salePrice;

      }

      public?void?setSalePrice(double?salePrice)?{

      this.salePrice?=?salePrice;

      }

      public?double?getVipPrice()?{

      return?vipPrice;

      }

      public?void?setVipPrice(double?vipPrice)?{

      this.vipPrice?=?vipPrice;

      }

      public?int?getAmount()?{

      return?amount;

      }

      public?void?setAmount(int?amount)?{

      this.amount?=?amount;

      }

      }


      網(wǎng)站名稱(chēng):刪除商品Java代碼 java刪除代碼怎么寫(xiě)
      網(wǎng)頁(yè)URL:http://www.ef60e0e.cn/article/dooddsp.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        南召县| 汾阳市| 杭锦后旗| 永宁县| 昌宁县| 北川| 永济市| 贵港市| 富裕县| 灵寿县| 包头市| 中牟县| 开远市| 珲春市| 菏泽市| 兰溪市| 蒙城县| 广平县| 左贡县| 保德县| 张掖市| 上虞市| 三台县| 循化| SHOW| 邯郸市| 永吉县| 克什克腾旗| 嵊州市| 昌平区| 无为县| 咸宁市| 兰溪市| 呼图壁县| 福清市| 阜阳市| 长葛市| 来凤县| 平塘县| 昌图县| 大新县|