Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Person
- attr_reader :name
- attr_accessor :hygiene, :happiness, :bank_account
- def initialize(name = "unknown")
- @name=name
- @bank_account = 25
- @happiness = 8
- @hygiene = 8
- end
- def clean?
- if @hygiene > 7
- return true
- else
- return false
- end
- end
- def happy?
- if @happiness > 7
- return true
- else
- return false
- end
- end
- def check(variable, value)
- if variable >= 0 && variable <= 10
- variable = value
- end
- end
- def get_paid(salary)
- @bank_account += salary
- return "all about the benjamins"
- end
- def hygiene=(value)
- end
- def take_bath
- #if @hygiene < 0
- if @hygiene > 10
- @hygiene = 10
- end
- return "♪ Rub-a-dub just relaxing in the tub ♫"
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement