Need help with Intro to Computer Science 2 (Python) problem:
Modify the Animal class included in the template file to include two additional methods:
setAge() which takes an integer as a parameter and sets the animal's age to the value of the parameter
getAge() which takes no parameters and returns the age of the animal
You should also modify the speak(), __str__, and __repr__ methods to display the animal's age in addition to the animal's species and language and modify the constructor to take an additional parameter for the animal's age (as the last parameter), set to 0 if no age is provided. The following shows how the Animal class and its new/modified methods could be used:
Python 3.4.1 Shell Edit Debug Options Windows Help
>>> django = Animal('cat', 'meow', 15)
>>> django.getAge()
15
>>> django.speak()
I am a 15 year-old cat and I meow
>>> print(django)
The animal is a 15-year-old cat who meows
>>> cookie = Animal('cat', 'meeee', 0)
>>> cookie.setAge(11)
>>> print(cookie)
The animal is a 11-year-old cat who meeeevs.
>>> fido = Animal('dog', 'bark', 5)
>>> print(fido)
The animal is a 5-year-old dog who barks.