Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BankAccount
- attr_accessor :balance
- @@minimum_balance = 200
- def self.minimum_balance=(balance)
- @@minimum_balance = balance
- end
- def initialize(balance,name)
- if balance < @@minimum_balance
- raise ArgumentError.new("Error")
- else
- @balance = balance
- @name = name
- end
- end
- def deposit(deposit)
- @deposit = deposit
- @balance += @deposit
- end
- def withdraw(withdraw)
- @withdraw = withdraw
- @balance -= @withdraw
- end
- def transfer(transfer, account2)
- self.balance -= transfer
- account2.balance += transfer
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement