Page 1 of 1

Create a class called Invoice that a hardware store might use to represent an invoice for an item sold at the store. An

Posted: Thu Jul 14, 2022 2:11 pm
by answerhappygod
Create a class called Invoice that a hardware storemight use to represent an invoice for an item sold at thestore. An Invoice should include four pieces of informationas instance variables—a part number (type String), a partdescription (type String), a quantity of the item beingpurchased (type int) and a price per item (double). Your classshould have a constructor that initializes the four instancevariables. Provide a set anda get method for each instance variable. Inaddition, provide a method named getInvoiceAmount thatcalculates the invoice amount (i.e., multiplies the quantity by theprice per item), then returns the amount asa double value. If the quantity is not positive, itshould be set to 0. If the price per item is not positive, itshould be set to 0.0. Write a test appnamed InvoiceTest that demonstrates class Invoice’scapabilities.
Output should look like this
Create A Class Called Invoice That A Hardware Store Might Use To Represent An Invoice For An Item Sold At The Store An 1
Create A Class Called Invoice That A Hardware Store Might Use To Represent An Invoice For An Item Sold At The Store An 1 (59.38 KiB) Viewed 38 times
account 1 balance: $50.00 account 2 balance: $0.00 Enter withdrawal amount for account 1:20 subtracting 20.00 from account 1 balance account 1 balance: $30.00 account 2 balance: $0.00 Enter withdrawal amount for account 2:10 subtracting 10.00 from account 2 balance Debit amount exceeded account balance. account 1 balance: \$30.00 account 2 balance: \$0.00