Question
Write a program in Java to read numerals in Integer format (which is between 0 and 4000) and use a method to convert the number to an integer in Arabic form. The conversion could be done as shown in the following table.
Write a program in Java to read numerals in Integer format (which is between 0 and 4000) and use a method to convert the number to an integer in Arabic form. The conversion could be done as shown in the following table.
Arabic Numeral |
Integer Numeral |
M |
1000 |
D |
500 |
C |
100 |
L |
50 |
X |
10 |
V |
5 |
I |
1 |
Examples: IX(9), XLII(42), LXXXVII(87), CCXIX(219), MCCCLIV(1354), MMDCLXXIII(2673),
The program should repeat until a negative integer numeral is input.
MCDLXXVI(1476).