Question: Create the Animal class in the template file to include an constructor using _ _ init _ _ accepting the parameters in the images below.
Create the Animal class in the template file to include an constructor using init accepting the
parameters in the images below. Also set default values for the parameters. In addition to the
constructor add two more methods:
setAge which takes an integer as a parameter and sets the animal's age to the
value of the parameter
a
getAge which takes no parameters and returns the age of the animal
You should also modify the speakstr 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 if no age is provided.
The following shows how the Animal class and its newmodified methods could be used:
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
