Write a C++ program that (1) asks the user to input a year number expressed in the Roman notation, (2) validates whether it is an existing and valid Roman number (i.e. (a) whether it does not consist of letters other than IVXCM, and (b) it does not have more than three such letters appearing one after the other) – if it is invalid for a reason (c) the program should issue a warning but still carry out the further processing, then (3) converts this year number into an ARABIC year number (for example it converts the year expressed as a ROMAN number (MCMXCIX) into Arabic 1999), and finally (4) displays the Arabic equivalent of this year. Hint: To achieve such a conversion, you need to know rules of formulation of Roman numbers. These rules are as follows: (1) Roman numbers are based on sum (or difference) of its components. They use the following components: M = 1000, D = 500, C = 100, L = 50 X = 10, V = 5, I = 1; (2) When a smaller component is placed in front of a larger component, it means that the smaller should be subtracted from the larger – e.g., Roman IX is 9 in Arabic, while Roman XC is 90 in Arabic. (3) ‘I’ can only be subtracted from V and X, but not from L or C. X can be subtracted from L and C, but not from M. Thus 99 is XCIX not IC! (4) For the validation purpose you need to know that with the exception for M, Roman numerals do not have more than three symbols grouped together, and do not contain letters other than I, V, X, L, C, D, M. Your program should include at least three functions to do the input, processing (conversion), and output. Also include a loop that will allow the user to repeat the whole program if he wants to. Test your program on the following Roman dates: MCMIX (1909), MCMXCVII (1997), MCMXCIX (1999), MMIX (2009).   PLEASE add "//" every code wirtten to explain its use in the program. thank you! do the following conditions set and DO IT IN C++

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter4: Selection Structures
Section4.3: Nested If Statements
Problem 7E
icon
Related questions
Question

Write a C++ program that (1) asks the user to input a year number expressed in the
Roman notation, (2) validates whether it is an existing and valid Roman number (i.e. (a)
whether it does not consist of letters other than IVXCM, and (b) it does not have more
than three such letters appearing one after the other) – if it is invalid for a reason (c) the
program should issue a warning but still carry out the further processing, then (3) converts
this year number into an ARABIC year number (for example it converts the year
expressed as a ROMAN number (MCMXCIX) into Arabic 1999), and finally (4) displays
the Arabic equivalent of this year.
Hint: To achieve such a conversion, you need to know rules of formulation of Roman
numbers. These rules are as follows:
(1) Roman numbers are based on sum (or difference) of its components. They use the
following components:

M = 1000,
D = 500,
C = 100,
L = 50
X = 10,
V = 5,
I = 1;

(2) When a smaller component is placed in front of a larger component, it means that the
smaller should be subtracted from the larger – e.g., Roman IX is 9 in Arabic, while Roman
XC is 90 in Arabic.
(3) ‘I’ can only be subtracted from V and X, but not from L or C. X can be subtracted from
L and C, but not from M. Thus 99 is XCIX not IC!
(4) For the validation purpose you need to know that with the exception for M, Roman
numerals do not have more than three symbols grouped together, and do not contain
letters other than I, V, X, L, C, D, M.
Your program should include at least three functions to do the input, processing
(conversion), and output. Also include a loop that will allow the user to repeat the whole
program if he wants to.
Test your program on the following Roman dates: MCMIX (1909), MCMXCVII (1997),
MCMXCIX (1999), MMIX (2009).

 

PLEASE add "//" every code wirtten to explain its use in the program. thank you! do the following conditions set and DO IT IN C++

Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Datatypes
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning