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
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
Get step-by-step solutions from verified subject matter experts
