90 058
Assignments Done
99.7%
Successfully Done
In September 2020

# Answer to Question #9064 in MatLAB | Mathematica | MathCAD | Maple for sara

Question #9064
. Write a script/function that converts a Roman numeral to its decimal equivalent.
There are two distinct situations that you might design your program for:

a. The &quot;old&quot; style where the order of the symbols does not matter. In this case, IX and XI both mean 10 + 1 or 11. You should be able to handle the following conversion table:

Roman Decimal
I 1
V 5
X 10
L 50
C 100
D 500
M 1000

b. The &quot;new&quot; style where the order of the symbols does matter. For example, IX is 9 (10 - 1), XC is 90 (100 - 10). The conversion table given above still holds and you may assume for this case that the only instances of &quot;order&quot; you will encounter are

IV (4), IX (9), XL (40), XC (90), CD (400) and CM (900)

The function input will be useful here. The format

&gt;&gt; str = input(&#039;Roman numeral: &#039;,&#039;s&#039;)

will provide a way to get the Roman number into your program as a string. It would be a good idea to try case a. first.
0

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!