Originally posted by Adam Price:
I am working on 4b.
Originally posted by Adam Price:
My nitpicker says: Notice how there's a bunch of similar code in your method? (...) I wonder if you could simplify your method if you went through that process only once? (You'd have to call the method more than once, of course, and pass it the parameters it would need for each case then...)
Any direction?
It was suggested that I make identifiers (...) instead of typing out a bunch of zeros ([int oneMillion = 1000000. Given that, since they are used only in the second method, why is it preferable to pull them out of the method and have them be static finals for the whole class?
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Marilyn de Queiroz:
It sounds like your nitpicker is trying to help you be a little less "long winded" while still being "crystal clear". If the code for billions, thousands and millions is almost identical (for example, "appends the name of the period followed by a comma if necessary"), and only the values are different, perhaps you need another method, one that maybe passes in the different values (for example, the name of the period).
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Stuart Goss:
My main method modelled what I understood my mind was doing when I saw a really big number (you know, reading from left to right but making sure I knew how many digits were on the right of the number ...).
Originally posted by Stuart Goss:
Is this giving away too much?
Stuart
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Marilyn de Queiroz:
The backwards solution does work, but it is never as clean as ..... the more popular solutions.
Originally posted by Adam Price:
What number is this: 172691111 ?
JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Originally posted by Adam Price:
* Stuart - What number is this: 172691111 ?
. . . . . . If you can truly read that left to right, I will concede.
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
|