Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Instructor's Solution to 4b

 
Adam Price
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:


-Adam
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
true
 
Pauline McNamara
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No other "bugs" in that example?
[ February 22, 2006: Message edited by: Pauline McNamara ]
 
Adam Price
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Pauline McNamara:
No other "bugs" in that example?



Oh yeah - that too.
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hmmm. I guess that particular number was never tested by the instructor.
 
Adam Price
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marilyn de Queiroz:
Hmmm. I guess that particular number was never tested by the instructor.


I think I found the problem - it is in the beginning of main:

 
Stuart Goss
Ranch Hand
Posts: 169
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hihihi

Stuart
 
paul wheaton
Trailboss
Pie
Posts: 21742
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Adam - you indenting is all cattywumpus in your code sample!

This is a bug in the instructor's solution! I'll have to take a look at it tonight!
 
Adam Price
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Paul Wheaton:
Hey Adam - you indenting is all cattywumpus in your code sample!

This is a bug in the instructor's solution! I'll have to take a look at it tonight!


MY indenting?? But I quoted it directly out of the instructor's solution

Could someone send me the revised instructor's solution when it comes out? I promise not to make up any more outrageous lies about what it says.

-Adam
 
Pauline McNamara
Sheriff
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean that wasn't the real solution?

We can send you that Ray. If you don't hear from someone for a while, it's probably a good idea to post back here and prod a little.

Thanks for the input!
 
paul wheaton
Trailboss
Pie
Posts: 21742
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 unit testing. 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.
 
Carol Murphy
village idiot
Bartender
Posts: 1203
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4012
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're working on it. More news as events warrent.
 
Marilyn de Queiroz
Sheriff
Posts: 9067
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I sent a copy to Adam.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic