Write a class amount that represents a collection


Python programming:

"""3) Write a class Amount that represents a collection of nickels and pennies.

Include a property method value that computes the value of the amount from the nickels and pennies. Do not add a value attribute to each Amount instance.

Finally, write a subclass MinimalAmount with base class Amount that overrides the constructor so that all amounts are minimal.

An amount is minimal if it has no more than four pennies.
"""

class Amount(object):
"""An amount of nickels and pennies.

>>> a = Amount(3, 7)
>>> a.nickels
3
>>> a.pennies
7
>>> a.value
22
"""
"*** YOUR CODE HERE ***"

class MinimalAmount(Amount):
"""An amount of nickels and pennies with no more than four pennies.

>>> a = MinimalAmount(3, 7)
>>> a.nickels
4
>>> a.pennies
2
>>> a.value
22
"""
"*** YOUR CODE HERE ***"

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a class amount that represents a collection
Reference No:- TGS0119519

Expected delivery within 24 Hours