Assignment: #RomanNumeral Due: X/XX/MMXVII Points: III

Specification

Write a Java application that converts integers that are less than 4000 into Roman Numerals and Roman Numerals into integers.

Prompt the user to enter either an integer or a Roman Numeral. If an integer is entered, then print its Roman Numeral equivalent; else, print the integer equivalent of the Roman Numeral. Loop until the user enters a -1. Print error messages if integers less than 1 or greater than 3999 are entered. Print error messages if invalid Roman Numerals are entered.

Your program must have a method named rntoi() that converts a roman numeral into an integer. And it must have a method named itorn() that converts an integer to roman numeral.

   static int rntoi(String rn);
   static String itorn(int n);
Roman Numeral Notes
   I = 1
   V = 5
   X = 10
   L = 50
   C = 100
   D = 500
   M = 1000

Note: The same roman numeral digit cannot be used four times consecutively. Examples.

   4 is IV, not IIII
   9 is IX, not VIIII
   40 is XL, not XXXX
   90 is XC, not LXXXX
   99 is XCIX, not LXXXXVIIII
Example Output

Each output line has the format: input_value " is " converted_value

CI is 101                  <-- input: CI
101 is CI                  <-- input: 101
MMMCCCXXXVVVIII is 3348          
3348 is MMMCCCXXXVVVIII
XCIX is 99
99 is XCIX
MMXVII is 2017
2017 is MMXVII
CCCXIV is 314
314 is CCCXIV
MIX is 1009
1009 is MIX
LIX is 59
59 is LIX
XLII is 42 
42 is XLII
VIII is 8
8 is VIII
MMCXVI is 2116
2116 is MMCXVI
XLIX is 49
49 is XLIX
L is 50
50 is L
M is 1000
1000 is M
MMMCMXCIX is 3999
3999 is MMMCMXCIX
I is 1
1 is I
MCMLVII is 1957
1957 is MCMLVII
CCV is 205
205 is CCV
MMMMCXVI is invalid input
4000 is invalid input
CSC205 is invalid input
0x205 is invalid input
-1