... get part number
29 public String getPartNumber() {return partNumber;}
30
31 // get description
32 public String getPartDescription() {return partDescription;}
33
34 // get quantity
35 public int getQuantity() {return quantity;}
36
37 // get price per item
38 public double getPricePerItem() {return pricePerItem;}
39
40 // return String representation of Invoice object
41 @Override
42 public String toString() {
43 return String.format("%s: %n%s: %s (%s) %n%s: %d %n%s: $%,.2f",
44 "invoice", "part number", getPartNumber(), getPartDescription(),
45 "quantity", getQuantity(), "price per item", getPricePerItem());
46 }
47
48 // method required to carry out contract with interface Payable
49 @Override
50 public double getPaymentAmount() {
51 return
Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.