Guest User

Untitled

a guest
Apr 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. class Account
  2. ## has a balance / return the balance (get/set)
  3. #
  4. attr_accessor :balance
  5. attr_accessor :bank
  6.  
  7. ## has a label
  8. #
  9. attr_accessor :label
  10.  
  11. def initialize(label)
  12. self.label = label
  13. self.balance = 0.0
  14. self
  15. end
  16.  
  17. ##
  18. # deposit funds
  19. def deposit(amount)
  20. self.bank.deposit(amount, self)
  21. end
  22.  
  23. ##
  24. # withdraw funds
  25. def withdraw(amount)
  26. self.bank.withdraw(amount, self)
  27. end
  28. end
Add Comment
Please, Sign In to add comment