Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions

Question

\f

Answered: 1 week ago