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

来源:百度知道 编辑:UC知道 时间:2024/05/29 00:54:16
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.

请创建一个叫Invoice的类,某五金店可用来表示该店所售出商品的发票。
一张发票应包括四部分信息,作为实体变量---部件号(String型),部件描述(String型), 所购买商品的数量 (int型)以及每件商品的价格 (double型)。
你的类应有一构造函数对这四个实体变量进行初始化。对每个变量提供一个设定和一个取得方法。
此外,要提供一个名为getInvoiceAmount的方法,用以计算发票金额 (即,将数量乘上每件商品的价格),然后以double值返回此金额.若数量非正数,应置为0。 若单价非正数,应置为0.0。
请写一个名为InvoiceTest的测试应用,演示 Invoic类的功能。

这么长 还没有格式