Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void transfer(BankAccount acct, double amount){
- //Does nothing if transfer amount is 0 or less
- if(amount >= 0){
- if(this.balance > 5){
- this.transactions++;
- acct.transactions++;
- //Transfers their remaining balance if there are insufficient funds
- if((this.balance - 5) <= amount){
- acct.balance += this.balance - 5;
- this.balance = 0;
- }
- //Executes a normal transaction if there are enough funds
- else{
- this.balance -= (5.00 + amount);
- acct.balance += amount;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement