Solved

Give the Definition of an Abstract Class Named Currency That

Question 43

Essay

Give the definition of an abstract class named Currency that stores a currency amount (as an integer value). Include in the class an __init__ method and an abstract __str__ method. Define three subclasses of the Currency class named USCurrency (dollars), EuroCurrency (euros), and the ChineseCurrency (yuan). Implement the __str__ method of each so that the proper currency symbol is displayed. The Unicode string for displaying Euro and Chinese currency symbols are '\u20AC' and '\u5143, respectively.

Correct Answer:

verifed

Verified

class Currency(object):
def __init__(se...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions