Java Beginner needs help with creating a Class
I am working on the same problem that flpanthers1 posted back on 6/6. 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's details.
Here is what I have so far. It compiles but I am not sure if I set it up right. Any suggestions/help would be greatly appreciated!!
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);