Question: In the exercises in Chapter 6, you created a class named Purchase. Each Purchase contains aninvoice number, amount ofsale, amount ofsales tax, and several methods.

In the exercises in Chapter 6, you created a class named Purchase. Each Purchase contains aninvoice number, amount ofsale, amount ofsales tax, and several methods. Add get methods for the invoice number and saleamount fields sotheir values can be used in comparisons. Next, write a program that declares anarray of five Purchase objects andprompt a user for their values. Then, in a loop that continues until a user inputs a sentinel value, ask the user whether the Purchase objectsshouldbesortedanddisplayedininvoicenumberorderorsaleamountorder. Save the file asSortPurchasesArray.java.

Enhance the program by displaying a menu that asks the user how they want to sort the services menu. 1) Sort by Invoice, 2) Sort by Amount of Sale, 3) Sort by Sales Tax, or 0) to Exit. Add a do...while() loop that keeps prompting the user for the next preferred sort order until the user finally chooses 0 to exit

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!