Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

2 Determine research design.

Answered: 1 week ago