Question: python Create a parent class Dog. Add 03 instance variables name, age and vaccine_status (True/False) of a dog object. The vaccine status by default should

  1. python
  2. Create a parent class Dog.
    1. Add 03 instance variables name, age and vaccine_status (True/False) of a dog object. The vaccine status by default should be False. Make sure you initialize the instance variables. create and initialize the class variable species with value "Canis familiaris".
    2. Write a special method __str__ to show the string representation of an object. The __str__ function should return the name and age information of the dog.
    3. Write another method speak that should return the string specifying " says , sound should be the parameter of this method.
    4. Add another method, vaccinate, that should change the value of vaccine_status.
  3. Write a sub-class GoldenRetriever, inherited form the parent class you just created.
    1. Override the method speak by adding the default sound to "Bark" and call the super class method speak in it.
    2. python

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!