帮助伪代码和循环
伪代码
Inventory service class
public class Inventory
// declarations
private itemnumber : integer
private originalprice : integer
public Inventory ()
itemnumber = 0
originalprice = 0
return
public Inventory (ite : integer, ori : integer)
itemnumber = ite
originalprice = ori
return
public integer getitemnumber( )
return itemnumber
public integer getoriginalprice( )
return originalprice
public void setItemnumber(integer ite)
itemnumber = ite
return
public void setOriginalprice (integer ori)
originalprice = ori
return
End Class
Public class PayReport
PSEUDOCODE
Inventory service class
public class Inventory
// declarations
private itemnumber : integer
private originalprice : integer
public Inventory ()
itemnumber = 0
originalprice = 0
return
public Inventory (ite : integer, ori : integer)
itemnumber = ite
originalprice = ori
return
public integer getitemnumber( )
return itemnumber
public integer getoriginalprice( )
return originalprice
public void setItemnumber(integer ite)
itemnumber = ite
return
public void setOriginalprice (integer ori)
originalprice = ori
return
End Class
Public class PayReport
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在我看来,第四部分有点误导。我认为目的是读取包含库存项目的文件,其中每个项目都位于单独的行上。因此,您将有一种方法可以读取文件,并在该方法中迭代文件中的每一行并添加库存项目。也许这是错误的,但似乎最有可能......或者这不是#1 的问题?
至于循环,我不明白你到底在问什么。您可以硬编码 7(7 天),或者有一个单独的成员,例如 numDaysOfSale,然后循环遍历并在该循环中进行百分比计算。
希望能有点帮助...
- 戴夫
Seems to me that the iv part is kind of misleading. I think the intent was to read a file that contains inventory item[s] where each item is on a separate line. So you would have one method that would read the file and in that method iterate over each line in the file and add an inventory item. Maybe that is wrong but seems the most likely... Or is that not the question for #1?
As for the looping, I'm not understanding exactly what you are asking. You could just hard-code 7 (for the 7 days) or have a separate member something like numDaysOfSale then just loop over that and do the percentage calculation in that loop.
Hope that helps a little...
- Dave