Question: Java Create an Invoice class that might serve as a receipt for items sold. An Invoice should be defined by the following attributes: productName :
Java
Create an Invoice class that might serve as a receipt for items sold. An Invoice should be defined by the following attributes:
productName : String
quantityPurchased : int
pricePerItem : double
Provide getters and setters for each attribute, making sure that the numeric values given are not negative. Set them to 0 if they are. Include a method that calculates the invoice amount (i.e., multiplies the quantity by the price per item), then returns the amount as a double value. Write a test program that shows everything working.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
