Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python module that contains the following: A custom class named LandMammal that holds data facts regarding the world's largest land mammals. A main() function that

Python module that contains the following:

  • A custom class namedLandMammalthat holds data facts regarding the world's largest land mammals.
  • Amain()function that contains unit test cases for the LandMammal class.

TheLandMammalclass should implement a constructor that sets up the following instance variables:

  • name (string)
  • minimum mass in pounds (int)
  • maximum mass in pounds (int)

Hint.Implement a constructor with__init__()

You will also need to provide a method namedmass_range()to calculate and return the following attribute:

  • calculate the range of mass and return an int.

Themain()function should create test cases for the following:

  • the constructor
  • themass_range()method

Invoke themain()function with the final statements in your module making sure that unit test code only runs when the module is run by itself and not when the module is imported by another program.

Hint.Include the following statements at the end of your module.

if__name__=='__main__':

main()

When this program is run directly (rather than having been imported), the console session should contain the unit testing output and should look like this:

Unit testing output follows... Testing the constructor: African elephant 10000 24000 Testing the mass_range method: 14000 

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

Modern Dental Assisting

Authors: Doni Bird, Debbie Robinson

13th Edition

978-0323624855, 0323624855

Students also viewed these Programming questions