|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectPaymentProcessor
public class PaymentProcessor
Class to do data entry and simple processing of payments. Will maintain an ordered list of payments where each new payment is added to the end of the list and payments can be retrieved by list position.
Constructor Summary | |
---|---|
PaymentProcessor(int capacity)
Creates payment processor with no payments in the list. |
Method Summary | |
---|---|
void |
addPayment(Payment payment)
Add given payment to end of list of payments to be processed. |
int |
getCapacity()
Get capacity of list. |
int |
getNumberOfPayments()
Get count of number of payments in the list. |
Payment |
getPayment(int position)
Get specified payment number. |
double |
getSumOfPayments()
Get sum of all payments in the list. |
static Payment |
inputNewPayment()
User inputs valid payment information, then method returns object representing the payment. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PaymentProcessor(int capacity)
Precondition: capacity >= 0.
capacity
- Maximum number of payments that can be placed in the list.Method Detail |
---|
public static Payment inputNewPayment()
public void addPayment(Payment payment)
Precondition: payment != null.
Precondition: getNumberOfPayments() < getCapacity().
payment
- A Payment object to be processedpublic double getSumOfPayments()
public int getNumberOfPayments()
public int getCapacity()
public Payment getPayment(int position)
Precondition: 0 <= position < getNumberOfPayments().
position
- Integer position in the list. First position is 0.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |