Question: I need help on writing a code. Instructions CreatePurchase.java Purchase.java + 1 public class Purchase { Create a class named Purchase . Each Purchase contains
I need help on writing a code.

Instructions CreatePurchase.java Purchase.java + 1 public class Purchase { Create a class named Purchase . Each Purchase contains an invoice number, amount of sale, and W N private int invoiceNumber; private double saleAmount; private double tax; amount of sales tax. Include set methods for the private static final double RATE = 0. 05; invoice number and sale amount. Within the 6 public void setInvoiceNumber (int num) { set() method for the sale amount, calculate 7 } the sales tax as 5% of the sale amount. Also 8 public void setSaleAmount (double amt) { include a display method that displays a 9 10 purchase's details. public double getSaleAmount ( ) { 11 12 public int getInvoiceNumber ( ) { Grading 13 } 14 public void display ( ) { Write your Java code in the area on the right. Use 15 System. out. print In( "Invoice #" + invoiceNumber + the Run button to compile and run the code. 16 " Amount of sale: $" + saleAmount + " Clicking the Run Checks button will run pre- Tax: $" + tax) ; 17 configured tests against your code to calculate a 18 } grade. 19 Once you are happy with your results, click the Submit button to record your score
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
