Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. class Person
  2.  
  3. attr_reader :name
  4. attr_accessor :hygiene, :happiness, :bank_account
  5.  
  6. def initialize(name = "unknown")
  7. @name=name
  8. @bank_account = 25
  9. @happiness = 8
  10. @hygiene = 8
  11. end
  12.  
  13. def clean?
  14. if @hygiene > 7
  15. return true
  16. else
  17. return false
  18. end
  19. end
  20.  
  21. def happy?
  22. if @happiness > 7
  23. return true
  24. else
  25. return false
  26. end
  27. end
  28.  
  29. def check(variable, value)
  30. if variable >= 0 && variable <= 10
  31. variable = value
  32. end
  33. end
  34.  
  35. def get_paid(salary)
  36. @bank_account += salary
  37. return "all about the benjamins"
  38. end
  39.  
  40. def hygiene=(value)
  41.  
  42. end
  43.  
  44. def take_bath
  45. #if @hygiene < 0
  46. if @hygiene > 10
  47. @hygiene = 10
  48. end
  49. return "♪ Rub-a-dub just relaxing in the tub ♫"
  50. end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement