Question: I need help completing this problem. I am writing the code in Java and have gotten pretty far with help from my textbook but how

I need help completing this problem. I am writing the code in Java and have gotten pretty far with help from my textbook but how do I complete the code to answer the question? I am stuck on the InvoiceTest.java part. Thank you.
/*
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 variablesa 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 app named InvoiceTest that demonstrates class Invoices capabilities.
*/
 I need help completing this problem. I am writing the code
in Java and have gotten pretty far with help from my textbook
but how do I complete the code to answer the question? I
am stuck on the InvoiceTest.java part. Thank you. /* Create a class

3.12 Invoice.javea //COP 3330-0R06 Donuay 27th, 2018 3.12 [s points] (Invoice Class) Create a class called Invoice thot a hardware store might use to represent 6 7 an invoice for an item sold at the store. An Invoice should include four pieces of information as 8 instance vartables-o part number (type String) a part description (type String), a quantity of the 9 item being purchased (type int) and a price per item (double). Your class should have a constructor 10 that initializes the four instance variables. Provide a set and a get me thod for each instance variable. 11 In addition, provide a methot named getInvoiceAmount that colculates the invoice amount (.e., multiplies the quantity by tfhe price per item), then returns the amount as a double value. If the 13 quantity is not positive, it should be set to e. I 14 .e. write a test app named InvoiceTest that demonstrates class Invoice's capabilities. 15 16 17 18 f the price per item is not positive, it should be set to public class Main//Public class Invoice begins 19 private String PartNumber;//Instance variable with type string for part numbers 20 private String PartDescription;//Instance variable with type String for part descriptions 21 private int PartQuantity://Instance vartable with type int for part quontities private doubleP 22 23 24 25 able with type double for prices per items 26 public Main (String Parthumber, String PartDescription, int PartQuantity, double PricePerItea )//Constructor receiving four parameters 27 28 this.PartNumber -PartNumber;//PartNumber is asstgned to Num this.PartDescription-PartDescription;//PartDescription is assigned to Des this.PricePeritem-Price;//PricePerItem is assigned to Price if ( Partouantity0 )//If PartQuantity {s not positive 29 31 32 this.PartQuantity -0://set PartQuantity to e

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!