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.
I like the sound of that! Now I have to research unit testing..... (Still muddling through the ANT stuff in my spare time, which has been precious little as of late. )
Pauline McNamara
Sheriff
Joined: Jan 19, 2001
Posts: 4011
posted
0
Originally posted by Paul Wheaton:
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.
I'm not sure I'm following.
So are you saying you're thinking of adding a Unit Testing section to the assignments, and using code like this instructor's solution as the test code, and cleaning it up that way?