Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a class named Purchase. Each Purchase contains an invoice number, amount

ID: 3570414 • Letter: C

Question

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 7.5% (using a static field in the Purchase class) of the sale amount.The Purchase class contains no main method and does not perform input or output. Save the program as Purchase.java.

Create a class named PurchaseOrder to instantiate and test the Purchase class. PurchaseOrder shall include a display method that displays the purchases' details in a well formatted output display, using only dialogs, not System.in, System.out, or Scanner. Test the Purchase class by having PurchaseOrder create at least three Purchase objects. You can "hard code" these in the code, or use user input via dialog to create the Purchase objects. The output from PurchaseOrder shall consist of a single dialog which itemizes each Purchase attributes, as well as showing total sales and sales tax. Save the file as PurchaseOrder.java.

Explanation / Answer

PROGRAMME OF CLASS NAMED PURCHASE

public class Purchase
{

private int invoice;
private double sale;
private double salesTax;


public void setInvoice(int invoiceNumber)
{
invoice = invoiceNumber;

}
public void setSale (double saleAmount)
{
double sale = saleAmount;
double salesTax = (saleAmount * .05);
}
public void DisplaySale ()
{
System.out.println("Invoice # >" + invoice + "Sale Amount = " + sale
+ "Sales Tax = " + salesTax);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote