This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Well, I actually got me code working with 4B, and am on the brink of sending it in. The only problem I have is I can't figure a way to get rid of superfluous commas when one is not called for at the end of the final string. Here are some examples, one that works fine I think, and then a couple that don't: c:\java Sayb 10000500010 ten billion, five hundred thousand, ten c:\java Sayb 1000 one thousand, c:\java Sayb 147586000 one hundred forty-seven million, five hundred eighty-six thousand, I'm not sure how much, if any, code I would want to post, but I think y'all have probably seen something like this before. Should I just wait to get the nit picked out of me? I'm just happy it works!!! (156 lines, including comments) Thanks, Jason Adam
i am on my second attept at 4b. i used "-" between all of my numbers, though. they come out like one-hundred-billion-twenty-three. i do not know which one is right, so please tell me if anyone knows. to get rid of the unused "," make something that will only print the "," if the next set of digits are not equal to "0"... in other words, instead of automatically appending the "," to your bigger number, do it only if neccesarry.
Greg '-' between every word is wrong. Testing your example using the instructors solution gives one hundred billion, twenty-three As for the commas yes, as far as I know they are not to strict on it. But if you submit the perfect solution, heck Marilyn might just decide to find something. Hard to say. The general rule is give the assignment your best shot.Submit it and see what nitpick you get back. But remember dont waste the nitpickers time with rubbish that you for yourself know is not right.
[This message has been edited by Johannes de Jong (edited May 31, 2001).]
Hyphens should only be between the tens and the ones like: one thousand, one hundred twenty-three or one thousand one hundred twenty-three
JavaBeginnersFaq "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joined: Apr 12, 2001
oh, that was not clear in the instructions... and i did not get nitpicked for it on my first attempt! no big deal, though. i do not think it will take too much to change.
Chicken Farmer ()
Joined: May 08, 2001
Well, I first need to go back through 4a, lots of nits in there I need to get rid of, but I pretty much resigned myself to using the comma as a seperate string. Problem is I think I've already nested too many if/else if statements inside of each other that I'm going to be picked to pieces, but hey, what a great way to learn! Thanks y'all, Jason