Skip to content

Latest commit

 

History

History
100 lines (84 loc) · 2.69 KB

README.md

File metadata and controls

100 lines (84 loc) · 2.69 KB

Arabic-Roman-Converter

Java application for Arabic-Roman and Roman-Arabic numeral conversion.

Installing

To launch the app simlpy download executable jar file - target/ArabicRomanConverter-1.3.jar.

Preview

Starting point is a rules reminder:

screenshot-3

Input is case insensitive, trimmed from both ends:

screenshot-1

In case of violation of rules or typo you'll get an error message: screenshot-2

Rules

Roman numerals are based on the following symbols:

Symbol Value
I 1
V 5
X 10
L 50
C 100
D 500
M 1000

Rule #1

Only the digits I, X, C and M can be repeated up to three times.

Example:

Legal Illegal
MMM CCCC
CCC IIII
II VV

Rule #2

When a digit of lower value is written to the right or after a digit of higher value, then the values of all digits are added.

Example:

CCXXX C + C + X + X + X 100 + 100 + 10 + 10 + 10
MMXIII M + M + X + I + I + I 1000 + 1000 + 100 + 1 + 1 + 1

Rule #3

When a digit of lower value is written to the left or before a digit of higher value, then the value of the lower digit is subtracted from the value of the higher digit.

Example:

XXIV X + X + |I - V| 10 + 10 + 4
CMXLIX |C - M| + |X - L| + |I - X| 900 + 40 + 9