Number to word converter java code
Get via App Store Read this post in our app!
Number to spanish word converter
This converts from a number to a Spanish word for example :
I used a divide-and-conquer approach:
Unless I am reading incorrectly, you should not require any of the getSorted() methods for the three enum types as they are already. sorted.
- ExSpanishSufix is sorted by exponent , but you have already arranged the values by that in increasing order.
- SpanishDigits is sorted by number , but you have already arranged the values by that in increasing order.
- SpanishTens is sorted by number , but you. get the drift.
BTW, you can also rely on the ordinal() method for SpanishDigits to get the numeric values they represent, instead of having the extra field number .
Inside AbstractLangNumber , you can also consider inlining the results:
Also, your bracing style is quite inconsistent. sometimes you use the Java convention, sometimes you don't, and sometimes you omit them completely. I will suggest sticking to the convention throughout to improve code readability.