thank you I fixed this
Code Select
//********************************************************************
// Invoice.java Author: Vince Guadalupe
//
// Creates a new invoice and calculates the customers total.
//
//********************************************************************
public class Invoice
{
//declares instance variables for: part number, part description, quantity of items, and price per item
private String partNumber, partDescription;
private int quantity;
private double pricePerItem;
//-----------------------------------------------------------------
// Sets up the an invoice by defining the part number, part description,
// the quantity of items and the price per item
//-----------------------------------------------------------------
public Invoice (String partNumber, String partDescription, int quantity, double pricePerItem)
{
this.partNumber = partNumber;
this.partDescription = partDescription;
this.quantity = quantity;
this.pricePerItem = pricePerItem;
}
// Setter method for part number variable
public void setpartNumber (String partNumber)
{
this.partNumber = partNumber;
}
// Getter method for part number variable
public String getpartNumber()
{
return partNumber;
}
// Setter method for part description variable
public void setpartDescription (String partDescription)
{
this.partDescription = partDescription;
}
// Getter method for part description variable
public String getpartDescription()
{
return partDescription;
}
// Setter method for quantity variable
public void setquantity (int quantity)
{
this.quantity = quantity;
if(quantity < 0) {
this.quantity = 0;
}
}
// Getter method for quantity variable
public int getquantity()
{
if(quantity < 0) {
this.quantity = 0;
}
return quantity;
}
// Setter method for price per item
public void setpricePerItem (double pricePerItem)
{
this.pricePerItem = pricePerItem;
if(pricePerItem < 0) {
this.pricePerItem = 0.0;
}
}
// Getter method for price per item
public double getpricePerItem()
{
if(pricePerItem < 0) {
this.pricePerItem = 0.0;
}
return pricePerItem;
}
//calculates and returns the invoice amount
public double getinvoiceAmount()
{
return (quantity * pricePerItem);
}
} // end class Invoice