java吧 关注:1,274,849贴子:12,788,999
  • 4回复贴,共1

初学者求各位大神解答.一道问题(有英文原版)

只看楼主收藏回复

在下是新手,刚学java不到半年,这道题我弄不明白题意,如果有哪位大神帮忙把程序写出来的话不胜感激.


1楼2013-05-29 15:07回复
    1.创建一个 java程序名字为 MyBusiness 用来列出一个商业公司的库存清单(方法仅限用methods)。
    这个Java程序具有下列要求:
    a.inventoryUnits — — 可用物品的数量 ;
    b.inventoryName-物品的名称。
    Java程序需要有以下methods:
    addInventoryUnit-添加一个或多个清单物品,与totalInvetoryUnits 的值同增 ;
    lessInventory--减少一个或多个库存物品,与由相同totalInventoryUnits 的值同时减少(不允许totalInventoryUnits 的值小于等于零);
    getInventoruUnits — — return 物品的数量 ;
    getIventoryTotal — — return 物品的总数,getInventoryDescription--return 物品的名称。2.使用上面的结果来创建程序,跟踪手上的物品的数目。您可以选择使用您所选择的清单物品的具体名称。例如: 您可以选择要跟踪的多少 Iphone 存货,或你积累了多少亲笔签名的篮球球衣.......
    这道题没有给一个output的例子,我是在不懂怎么样才能让程序记住一个输入名称,然后还在需要的时候提取出来...
    或者我理解题意理解错了,求各位解惑..


    2楼2013-05-29 15:09
    收起回复
      2025-08-21 09:50:28
      广告
      不感兴趣
      开通SVIP免广告
      1.Create a java class MyBusiness used to keep track of a business company's inventory(methods only). The java class has the following attributes:
      a. inventoryUnits--the quantity available of an item;
      b. inventoryName-- the name of an item.
      The java class has the following methods:
      addInventoryUnit-adds one or more to the inventory item,and increments the value of totalInvetoryUnits by the same;
      lessInventory-subtracts one or more units from the inventory item and decrements the value of totalInventoryUnits by the same(do not allow your values counted to go below zero;)
      getInventoruUnits--return the quantity of items;
      getIventoryTotal--returns the total number of units,getInventoryDescription returns the item name.
      2. Create a program that uses the above class to keep track of the number of items on hand.You may choose to use a specific name for an inventory item of your choosing. For example: you may choose to keep track of how many Iphone your have/process in your store, or how many autographed basketball jerseys you accumulate, or how many base cards you acquire.
      这就是原题了,谁哪怕让我见识下这道题的输出结果或者说模式是什么样的,就相当感谢了..
      新手再次拜谢.


      3楼2013-05-29 15:11
      回复
        哪位提点建议,满足下空虚感呗....


        4楼2013-05-29 17:46
        回复