Question: Define a class calledDog.The initializer takes 4 arguments: a breed (such as'Australian Cattle Dog'), the dog's name (also a string), an age (integer), and a
Define a class calledDog.The initializer takes 4 arguments: a breed (such as'Australian Cattle Dog'), the dog's name (also a string), an age (integer), and a weight (float).Set instance variables for each of the arguments.reprreturns a string that prints (remember,repritself does not print) like this:
----- Rocket -----
Breed: Australian Cattle Dog
Age: 8
Weight: 42.3 lbs.
This is just an example, use the data in theDoginstance, which may not'Rocket', etc.Write an instance method calleddogfightthat takes anotherDogobject as an argument.If one of the dogs is at least 10 years old and the other is less than 10, the younger dog wins.Otherwise, the heavier dog wins.If they have the same weight, return 'Tie'.Return the name of the dog that wins.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
