I have a working version of Java-4a which I think solves the problem fairly nicely. However, the JR Sheriff keeps hinting that I am duplicating something, which I cannot figure out.
I have ...
1 - Build needed
string arrays.
2 - Check if number is in allowed range.
3 - Check if number is between 0 and 19 (inclusive)
3a - do stuff to get output for number from 0 to 19 (one line of code)
3b - else do stuff to get output for number from 20 to 99 (one line of code)
I keep thinking that 0 to 19 needs to be handled differently than 20 to 99. After all, 0 to 19 is where you have to output things like "seventeen" etc rather than "thirty-one".
However, I keep getting hints that somehow there are elements in steps 3a and 3b that are common, and I am not seeing how.
Perhaps I am misunderstanding the nitpicks. Not sure if this helps anyone help me, but the nitpicks have been ...
"Rather than adding another (duplicate) array, I was trying to suggest that you take tens[inputNumber / 10] and print it outside this if/else block."
and
"Any way to avoid printing tens[tensDigit] twice??"
and
"Notice how the first part of your if and else are the same?"
I'm really missing something. Any help would be greatly appreciated.
Thanks!