Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions