This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Cattle Drive and the fly likes Instructor's Solution to 4b Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Instructor Watch "Instructor New topic
Author

Instructor's Solution to 4b

Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
true


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Pauline McNamara
Sheriff

Joined: Jan 19, 2001
Posts: 4012
    
    6
No other "bugs" in that example?
[ February 22, 2006: Message edited by: Pauline McNamara ]
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
Originally posted by Pauline McNamara:
No other "bugs" in that example?



Oh yeah - that too.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Hmmm. I guess that particular number was never tested by the instructor.
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
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

Joined: Mar 21, 2001
Posts: 169
hihihi

Stuart
paul wheaton
Trailboss

Joined: Dec 14, 1998
Posts: 20494
    ∞

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!


permaculture Wood Burning Stoves 2.0 - 4-DVD set
Adam Price
Ranch Hand

Joined: Nov 11, 2005
Posts: 95
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

Joined: Jan 19, 2001
Posts: 4012
    
    6
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

Joined: Dec 14, 1998
Posts: 20494
    ∞

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

Joined: Mar 15, 2001
Posts: 1194
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: 4012
    
    6
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

Joined: Jul 22, 2000
Posts: 9044
    
  10
We're working on it. More news as events warrent.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
I sent a copy to Adam.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Instructor's Solution to 4b
 
Similar Threads
javadoc @author tags don't appear
Hundred (1a) Stupid Question
CastMap getTrimmedString() error?
assignment hints
Java 1b question