edu.uci.ics.inf111.dvdvendor.devices
Class PaymentCollector
java.lang.Object
edu.uci.ics.inf111.dvdvendor.devices.PaymentCollector
public class PaymentCollector
- extends java.lang.Object
This class represents the payment-collecting portion of the system: the
credit-card or debit-card reader of the system. We are not concerned with
this part of the system, so a simple stub method with a simple validation
for the credit/debit card number is provided.
Field Summary |
private java.lang.String |
cardNumber
The String representation of the 16-digit card number. |
Method Summary |
boolean |
collect(java.lang.String cardNumber,
double amount)
This method is called by DVDVendor when the customer is finished adding items and
wishes to pay. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
cardNumber
private java.lang.String cardNumber
- The String representation of the 16-digit card number.
PaymentCollector
public PaymentCollector()
- Constructor for PaymentCollector
collect
public boolean collect(java.lang.String cardNumber,
double amount)
throws PaymentCollectorException
- This method is called by DVDVendor when the customer is finished adding items and
wishes to pay. It is a stub method which returns
true
, indicating successful payment.
It can throw a PaymentCollectorException when the card number
passed as parameter does not have a length of 16 characters
or the card number contains characters that are not numbers
- Parameters:
cardNumber
- The 16-digit card number.amount
- The amount of payment requested.
- Returns:
true
indicating payment accepted.
- Throws:
PaymentCollectorException
- if the cardNumber does not have a length of 16 characters
or the card number contains characters that are not numbers