Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BankAccount
- attr_accessor :amount
- attr_reader :name
- @@minimum_balance = 200
- def initialize(amount,name)
- @amount = amount
- raise ArgumentError.new("The minumun balance must be $299") if @amount < @@minimum_balance
- @name = name
- end
- def balance
- @amount
- end
- def deposit(depos)
- @amount += depos
- end
- def withdrawal(num)
- @amount -= num
- end
- def transfer(amount,bank_account)
- @amount -= amount
- bank_account.amount += amount
- end
- def self.minimum_balance=(amount)
- @@minimum_balance = amount
- end
- def self.minimum_balance
- @@minimum_balance
- end
- end
Add Comment
Please, Sign In to add comment