Using a set of provided class skeletons, create Currency and Money classes that pass all tests.
After completing this assignment, you should understand:
- How classes define methods for their objects
After completing this assignment, you should be able to:
- Create an instance method
- Call instance methods
- A Git repo containing all the provided starter files completed to make this program work.
- Tests in
money_test.py
pass - No PEP8 or Pyflakes warnings or errors
Read the classes Currency
and Money
as well as their tests. Using the docstrings included, complete these classes. Upon completion, the tests in money_test.py
should pass.
Take a look at this guide to Python's magic methods. Write tests for using the standard mathematical operators (+
, -
, *
, /
) on Money
and then implement the methods needed.
Go back to yesterday's assignment and re-read it. Then implement a CurrencyConverter
class that takes a list of rates, and has a convert
method to convert money. Write tests for this class.