|
1 | 1 | # Instructions |
2 | 2 |
|
3 | | -Given a number from 0 to 999,999,999,999, spell out that number in English. |
| 3 | +Given a number, your task is to express it in English words exactly as your friend should say it out loud. |
| 4 | +Yaʻqūb expects to use numbers from 0 up to 999,999,999,999. |
4 | 5 |
|
5 | | -## Step 1 |
| 6 | +Examples: |
6 | 7 |
|
7 | | -Handle the basic case of 0 through 99. |
8 | | - |
9 | | -If the input to the program is `22`, then the output should be `'twenty-two'`. |
10 | | - |
11 | | -Your program should complain loudly if given a number outside the blessed range. |
12 | | - |
13 | | -Some good test cases for this program are: |
14 | | - |
15 | | -- 0 |
16 | | -- 14 |
17 | | -- 50 |
18 | | -- 98 |
19 | | -- -1 |
20 | | -- 100 |
21 | | - |
22 | | -### Extension |
23 | | - |
24 | | -If you're on a Mac, shell out to Mac OS X's `say` program to talk out loud. |
25 | | -If you're on Linux or Windows, eSpeakNG may be available with the command `espeak`. |
26 | | - |
27 | | -## Step 2 |
28 | | - |
29 | | -Implement breaking a number up into chunks of thousands. |
30 | | - |
31 | | -So `1234567890` should yield a list like 1, 234, 567, and 890, while the far simpler `1000` should yield just 1 and 0. |
32 | | - |
33 | | -## Step 3 |
34 | | - |
35 | | -Now handle inserting the appropriate scale word between those chunks. |
36 | | - |
37 | | -So `1234567890` should yield `'1 billion 234 million 567 thousand 890'` |
38 | | - |
39 | | -The program must also report any values that are out of range. |
40 | | -It's fine to stop at "trillion". |
41 | | - |
42 | | -## Step 4 |
43 | | - |
44 | | -Put it all together to get nothing but plain English. |
45 | | - |
46 | | -`12345` should give `twelve thousand three hundred forty-five`. |
47 | | - |
48 | | -The program must also report any values that are out of range. |
| 8 | +- 0 → zero |
| 9 | +- 1 → one |
| 10 | +- 12 → twelve |
| 11 | +- 123 → one hundred twenty-three |
| 12 | +- 1,234 → one thousand two hundred thirty-four |
0 commit comments