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++

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
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
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education