Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save esse/ad37a48a9ffd4770c306a1d1a14e2e5d to your computer and use it in GitHub Desktop.
Save esse/ad37a48a9ffd4770c306a1d1a14e2e5d to your computer and use it in GitHub Desktop.
class Animal
attr_accessor :name
attr_accessor :age
attr_accessor :sex
def initialize(name, sex, age)
@name = name
@sex = sex
@age = age
@hunger_level = rand(10)
end
end
class Lion < Animal
#hunger_level = rand(10)
end
class Tiger < Animal
#hunger_level = rand(10)
end
class Monkey < Animal
#hunger_level = rand(10)
end
class Zoo
def initialize
@animals_in_zoo = []
end
def add_animal(name)
if @animals_in_zoo.include?(name)
"THE SAME ANIMAL - ERROR!"
else
@animals_in_zoo.push(name)
end
end
def feed_animal
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment