a. Create a class named Invoice that contains fields for an item number, name, quantity, price, and total cost. Create instance methods that set the item name, quantity, and price. Whenever the price or quantity is set, recalculate the total (price times quantity). Also include a displayLine() method that displays the item number, name, quantity, price, and total cost. Save the class as Invoice.java. b. Create a class named TestInvoice whose main() method declares three Invoice items. Create a method that prompts the user for and accepts values for the item number, name, quantity, and price for each Invoice. Then display each completed object. Save the application as TestInvoice.java.
a. Create a class named Invoice that contains fields for an item number, name, quantity, price, and total cost. Create instance methods that set the item name, quantity, and price. Whenever the price or quantity is set, recalculate the total (price times quantity). Also include a displayLine() method that displays the item number, name, quantity, price, and total cost. Save the class as Invoice.java.
b. Create a class named TestInvoice whose main() method declares three Invoice items. Create a method that prompts the user for and accepts values for the item number, name, quantity, and price for each Invoice. Then display each completed object. Save the application as TestInvoice.java.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 1 images