谁能帮我翻译以下(一道java题)

CreateaclasscalledInvoicethatahardwarestoremightusetorepresentaninvoiceforanitemsolda... Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store.An Invoice should include four pieces of information as instance variables----a part number(type String),a part description(type String),a quantity of the item being purchased(type int)and a price per item(double).Your class should have a constructor that initializes the four instance variables.Provide a set and a get method for each instance variable.In addition,provide a method named getInvoiceAmount that calculates the invoice amount(i.e.,multiplies the quantity by the price per item),then returns the amount as a double value.If the quantity is not positive,it should be set to 0.If the price per item is not positive,it should be set to 0.0.Write a test application named InvoiceTest that demonstrates class Invoice's capabilities. 展开
 我来答
百度网友ccb91ec
2007-11-20 · TA获得超过690个赞
知道小有建树答主
回答量:559
采纳率:0%
帮助的人:644万
展开全部
请创建一个叫Invoice的类,某五金店可用来表示该店所售出商品的发票。
一张发票应包括四部分信息,作为实体变量---部件号(String型),部件描述(String型), 所购买商品的数量 (int型)以及每件商品的价格 (double型)。
你的类应有一构造函数对这四个实体变量进行初始化。对每个变量提供一个设定和一个取得方法。
此外,要提供一个名为getInvoiceAmount的方法,用以计算发票金额 (即,将数量乘上每件商品的价格),然后以double值返回此金额.若数量非正数,应置为0。 若单价非正数,应置为0.0。
请写一个名为InvoiceTest的测试应用,演示 Invoic类的功能。
wenlong69
2007-11-20 · TA获得超过177个赞
知道小有建树答主
回答量:338
采纳率:0%
帮助的人:127万
展开全部
这么长 还没有格式
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式