This should satisfy the requirements of programming assignment 2. I could (and perhaps should) have written unit tests for the entire thing, but I have tested the code and it appears to work exactly as specified.