Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Created by danie on 9/25/2016.
- */
- public class bankAccount {
- private String name;
- private double balance;
- private double transsactionFee;
- public void deposit(double amount){
- balance +=amount;
- }
- public void withdraw(double amount){
- if(balance - amount - transsactionFee >=0)balance -= (amount + transsactionFee);
- }
- public String toString(){
- return (name + ", $" +balance);
- }
- public void transfer(bankAccount other, double amount){
- if(amount >=5){
- balance -= 5;
- if(balance>=amount){
- balance-=amount;
- other.deposit(amount);
- }
- else{
- other.deposit(balance);
- balance = 0;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment