Question: Create a program named roman.java. Ask the user to enter a Roman Numeral. Output the numeric value of the Roman Numeral. You should have the

Create a program named roman.java. Ask the user to enter a Roman Numeral. Output the numeric value of the Roman Numeral. You should have the following method in your program:

int RomanToDecimal(String R)

Here's some numbers to test your program with: MCMXLII = 1942, MCMLXIX = 1969, DCCCLXXXVIII = 888

Hint: In the RomanToDecimal method, create a for loop that steps through each character of roman numeral.

M = 1000, D = 500, C = 100, L = 50, X = 10, V = 5, I = 1. MDCLXVI = 1000 + 500 + 100 + 50 + 10 + 5 + 1 = 1666

If a digit is out of order, then it is subtracted from the next digit.

This is only used for these combinations: CM = 900, CD = 400, XC = 90, XL = 40, IX = 9, IV = 4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!