Create a class named Purchase.
Each Purchase contains an invoice number, amount of sale, and amount of sales tax.
Include set methods for the invoice number and sale amount.
Within the set () method for the sale amount, calculate the sales tax as 5% of the sale amount.
Also include a display method that displays a purchase.
Save the file as
Create an application that declares a Purchase object and prompts the user for purchase details.
When you prompt for an invoice number, do not let the user proceed until a number between 1,000 and 8,000 has been entered.
When you prompt for a sale amount, do not proceed until the user has entered a non-negative value.
After a valid Purchase object has been created, display the object’s invoice number, sale amount, and sales tax.
Save the file as

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Purchase {

private int invoiceNumber; //Local variables for object to store data
private double amountSale, amountSalesTax, total;

public void setAmountSale(double sale) //public mutator for amountSale
amountSale = sale; //Set sale amount
amountSalesTax = 0.05 * amountSale; //Calculate tax amount
total = amountSale + amountSalesTax; //Calculate total...

By purchasing this solution you'll be able to access the following files: and

for this solution

or FREE if you
register a new account!

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats