@Test public void test1() { int input = 1879; ParseRomanNumerals tester = new ParseRomanNumerals(input); String testResults = tester.parse(); assertEquals("Result","MDCCCLXXIX", testResults ); }
public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix += ")"; } returnValue = prefix + parseUnder1000(_input) + suffix + returnValue; returnValue = returnValue.replaceAll("\\(I\\)", "M"); returnValue = returnValue.replaceAll("\\(II\\)", "MM"); returnValue = returnValue.replaceAll("\\(III\\)", "MMM"); return returnValue; }
ParseRomanNumerals { public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix += ")"; } returnValue = prefix + parseUnder1000(_input) + suffix + returnValue; returnValue = returnValue.replaceAll("\\(I\\)", "M"); returnValue = returnValue.replaceAll("\\(II\\)", "MM"); returnValue = returnValue.replaceAll("\\(III\\)", "MMM"); return returnValue; } }
ParseRomanNumerals { public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix += ")"; } returnValue = prefix + parseUnder1000(_input) + suffix + returnValue; returnValue = returnValue.replaceAll("\\(I\\)", "M"); returnValue = returnValue.replaceAll("\\(II\\)", "MM"); returnValue = returnValue.replaceAll("\\(III\\)", "MMM"); return returnValue; } ParseRomanNumerals(int input); }
ParseRomanNumerals { public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix += ")"; } returnValue = prefix + parseUnder1000(_input) + suffix + returnValue; returnValue = returnValue.replaceAll("\\(I\\)", "M"); returnValue = returnValue.replaceAll("\\(II\\)", "MM"); returnValue = returnValue.replaceAll("\\(III\\)", "MMM"); return returnValue; } ParseRomanNumerals(int input); String parse(); static void main(String[] args); }
ParseRomanNumerals { public String parse() { String returnValue = ""; String prefix = ""; String suffix = ""; while(_input/1000 > 0 ) { int current = _input/1000; int toBeParsed = _input%1000; returnValue = prefix + parseUnder1000(toBeParsed) + suffix + returnValue; _input = current; prefix += "("; suffix += ")"; } returnValue = prefix + parseUnder1000(_input) + suffix + returnValue; returnValue = returnValue.replaceAll("\\(I\\)", "M"); returnValue = returnValue.replaceAll("\\(II\\)", "MM"); returnValue = returnValue.replaceAll("\\(III\\)", "MMM"); return returnValue; } ParseRomanNumerals(int input); String parse(); static void main(String[] args);  }