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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started