From Wikipedia
The numeric system represented by Roman numerals originated in ancient Rome and remained the usual way of writing numbers throughout Europe well into the Late Middle Ages. Numbers in this system are represented by combinations of letters from the Latin alphabet. Roman numerals, as used today, are based on seven symbols:
Symbol | Value |
---|---|
M | 1000 |
D | 500 |
C | 100 |
L | 50 |
X | 10 |
V | 5 |
I | 1 |
Note that Roman numerals are not defined for zero or negative numbers!
Build a small utility that can convert Arabic numbers to Roman numerals. Develop the solution by using a TDD style.
- Make a wrapper so that the program can be called from the command line with a list of Arabic numbers
- Write a solution for converting in the opposite direction.
Arabic | Roman |
---|---|
-1 | error |
0 | error |
1 | I |
5 | V |
15 | XV |
42 | XLII |
9 | IX |
94 | XCIV |
1776 | MDCCLXXVI |