Package lock.core.banking
Class TransferUtils
java.lang.Object
lock.core.banking.TransferUtils
- Author:
- Ben Choi
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic TransferResultcheckBalanceAndTransfer(Account sender, Account recipient, int amount)This method checks whether the sender has enough money in her bank account to transfer the given amount to the recipient.
-
Constructor Details
-
TransferUtils
public TransferUtils()
-
-
Method Details
-
checkBalanceAndTransfer
public static TransferResult checkBalanceAndTransfer(Account sender, Account recipient, int amount)This method checks whether the sender has enough money in her bank account to transfer the given amount to the recipient. It also checks to make sure that the sender and recipient are not the same people. If all of those conditions are met, it will successfully transfer the funds.- Parameters:
sender- the Account instance of the senderrecipient- the Account instance of the recipientamount- the amount the sender is trying to send to the recipient- Returns:
- the result of this transaction
-