Problem: Numbers to Words

Write a method Letterize(number), which reads an integer and prints it in words in English according to the conditions below:

  • Print in words the hundreds, the tens and the ones (and the eventual minus) according to the rules of the English language.
  • If the number is larger than 999, you must print "too large".
  • If the number is smaller than -999, you must print "too small".
  • If the number is negative, you must print "minus" before it.
  • If the number is not built up of three digits, you shouldn't print it.

Sample Input and Output

Input Output Input Output
3
999
-420
1020
nine-hundred and ninety nine
minus four-hundred and twenty
too large
2
15
350
three-hundred and fifty
Input Output Input Output
4
311
418
509
-9945
three-hundred and eleven
four-hundred and eighteen
five-hundred and nine
too small
2
500
123
five-hundred
one-hundred and twenty three

results matching ""

    No results matching ""