//
// Invoice.java
// Class representing an invoice which implements the Payable interface
//
// Nadeem Abdul Hamid (based on Deitel & Deitel, Java How To Program)
// CSC 121 - Berry College
//

public class Invoice implements Payable {

    private String partNumber;
    private String partDescription;
    private int quantity;
    private double pricePerItem;

    // four argument constructor
    public Invoice( String part, String descrip, int count, double price ) {
        partNumber = part;
        partDescription = descrip;
        quantity = count;
        pricePerItem = price;
    } // end Invoice constructor

    // accessor methods...

    // return String representation of Invoice object
    public String toString() {
        return "invoice: \npart number: " + partNumber
	    + " (" + partDescription + ") \nquantity: "
	    + quantity + "\nprice per item: " + pricePerItem;
    } // end method toString

    // method to support Payable interface
    public double getPaymentAmount() {
        return quantity * pricePerItem;  // calculate and return total cost
    } // end method getPaymentAmount

} // end class Invoice