CS 2040

Exercise 3

Description

Due to a hiccup in the universe, you wake up one morning in Venice with a really bad headache and an Android phone that gives the date as being in year 600. You decide to go into business as an accountant, but working in the Roman numeral system gives you more headaches. Since you conveniently installed Cxxdroid on your phone a week earlier (your time), you will program your converter using C++.

Roman numerals today are typically written using a subtractive notation; for example, 4 is written as IV. In the year 600, this notation was not standardized (see here for a detailed discussion) so numbers were written in a purely additive form using the chart

I1
V5
X10
L50
C100
D500
M1000
14 would be written XIIII, and 1970 as MDCCCCLXX.

You are to build a simple Roman number calculator for addition and multiplication. It is to read pairs of Roman numbers and an operator, give the decimal equivalent of each, then write their sum or product as a Roman number.

    DCCVI + LXXV
    706 + 75 = 781 = DCCLXXXI
    C + XXIIII
    100 + 24 = 124 = CXXIIII
    VIII * XII
    8 * 12 = 96 = LXXXXVI
Notes:

Assumptions

Submission

Submit your solution to esubmit as ex3roman. There is no submission to Canvas, but Canvas does give the last date you can submit this assignment for credit.