Question: This question must be answered in JAVA Create a class called Invoice that a hardware store might use to represent an invoice for an item
This question must be answered in JAVA
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 two data membersa part name (type string), and the part price (type int). Your class should have a constructor that initializes the two data members. In addition, write a highestPrice method, which receives a variable number of arguments of type Invoice. The method returns a reference to the invoice that has the highest price. Write a test program that demonstrates class Invoice's capabilities. Provide a main() method that creates three Invoice objects and call the method highestPrice twice, first passing two objects of class Invoice and second passing three objects of class Invoice. After each call, print the invoice with the highest price
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
