Design and implement a money class that stores monetary


Question: Design and implement a Money class that stores monetary values in dollars and cents. Special method __init__ should have the following function header,

def __init__(self, dollars, cents)

Include special method __repr__ (__str__) for displaying values in dollars and cents: $ 0.45, $ 1.00, $ 1.25. Also include special method __add__, and three getter methods that each provide the monetary value in another currency. Choose any three currencies to convert to.
Save this code in Money.py.

In another file, write a program that tests your Money class. You have a lot of freedom here, just be sure you declare at least one Money object, then use all your methods, printing it, adding it to another Money object, and converting it to various currencies. Make your program user-friendly and print results in a way that make sense.

Solution Preview :

Prepared by a verified Expert
C/C++ Programming: Design and implement a money class that stores monetary
Reference No:- TGS02379284

Now Priced at $10 (50% Discount)

Recommended (92%)

Rated (4.4/5)