Question: Write a java program to convert an integer to roman. We have to solve it without loops, which is why I'm trying to figure out
Write a java program to convert an integer to roman. We have to solve it without loops, which is why I'm trying to figure out how to use replace.
I have the following code that I struggle to get working. Please don't send an answer with loops, I already know how to solve it that way.
Fingers crossed, I hope someone can help me out. :)

2 public class RomanNumerals 4 public String getRomanNumber(int number) I 6 return joinC"", nCopies(number, "I")) .replaceC"IIII", "IV") .replaceC"VV", "X") .replaceC"VIV", "IX") .replaceC"XXXXX", "L") .replaceC"XXXX", "XL") replaceC"LL", "C") .replaceC"LXL", "XC") .replaceC"CCCCC", "D") .replaceC"CCCC", "CD" . replace("DD", "M") .replace"DCD", "CM") 7 10 12 13 14 15 16 17 18 19
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
