This week's book giveaway is in the General Computing forum. We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line! See this thread for details.
Hmmm - I spent a lot of time trying to get the spacing to always come out right - my nitpicker didn't like my first attempts because they involved excessive if statements (true enough) I then approached it by having the first character of certain strings actually be "\b", the backspace character to retroactively remove spaces in certain cases. That worked, but got nitpicked out. In the end, I just dropped the struggle, wanting to pass, and left the bug in there.
I just tried out the instructor's solution and am [relieved? secretly pleased?] to note that it has the same error. If you have a hundreds digit but no tens or ones, there is an extra space between the word "hundred" and the period name (million, billion, etc.) as in:
I looked around on my computer and the solution I found was five years old. I asked Marilyn for an update. The two version do work slightly differently.
This sort of thing just cries out for unittesting. I'm also thinking of changing the way things are done a bit .... I'm also thinking that it could be a good candidate for a quick trip to something slightly more advanced (the world of unit testing).
Maybe the idea should be to permit a klunky version at this point, and then after the OO stuff, and the ant stuff, we can move into unit testing and come up with some better solutions.