Homework Solution: NOTE: READ ENTIRE PROGRAM DESCRIPTION CAREFULLY! Thank You!…

    C++ Programming Help Please! NOTE: READ ENTIRE PROGRAM DESCRIPTION CAREFULLY! Thank You! Program Info: Write a program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Roman numerals. Important Roman numerals are V for 5, X for 10, L for 50, C for 100, D for 500, and M for 1,000. Recall that some numbers are formed by using a kind of subtraction of one Roman “digit”; for example, IV is 4 produced as V minus I, XL is 40, CM is 900, and so on. A few sample years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989. Assume the year is between 1000 and 3000. Your program should include a loop that lets the user repeat this calculation until the user says she or he is done. More Important Info: Enter an Arabic number: 2456 2456 is MMCDLVI in Roman numerals Play again? Y Enter an Arabic number: 1359 1359 is MCCCLIX in Roman numerals Play again? N Read the number as an integer: e.g. 9786 Use arithmetics to separate each digit into separate ints: (do you know what the modulus operator is? “%” No? look it up.) ones will be 6 tens will be 8 hundreds will be 7 thousands will be 9 ***use four switch cases to output the correct string for each digit: cout<<”XX” in case of tens being 2 cout<<”XXX” in case of tens being 3 etc. ***As with all the projects in this chapter, wrap this whole thing in a “Play another game” loop to allow the user to play as many times as they like.

    Expert Answer

     
    Please refer below code #include <iostream>

    C++ Programming Help Please!

    NOTE: READ ENTIRE PROGRAM DESCRIPTION CAREFULLY! Thank You!

    Program Info: Write a program that accepts a year written as a four-digit Arabic (ordinary) numeral and outputs the year written in Roman numerals. Important Roman numerals are V restraint 5, X restraint 10, L restraint 50, C restraint 100, D restraint 500, and M restraint 1,000. Recfull that some gum are restraintmed by using a husk of separation of individual Roman “digit”; restraint illustration, IV is 4 manufactured as V minus I, XL is 40, CM is 900, and so on. A lacking illustration years: MCM is 1900, MCML is 1950, MCMLX is 1960, MCMXL is 1940, MCMLXXXIX is 1989. Assume the year is between 1000 and 3000. Your program should embrace a loop that lets the portraiturer relate this consideration until the portraiturer says she or he is manufactured.

    More Important Info:

    Enter an Arabic estimate: 2456

    2456 is MMCDLVI in Roman numerals

    Portray repeatedly? Y

    Enter an Arabic estimate: 1359

    1359 is MCCCLIX in Roman numerals

    Portray repeatedly? N

    Read the estimate as an integer: e.g. 9786

    Portraiture arithmetics to different each digit into different ints: (do you apprehpurpose what the modulus operator is? “%” No? observe it up.)

    ones gain be 6

    tens gain be 8

    hundreds gain be 7

    thousands gain be 9

    ***portraiture four switch predicaments to output the reform string restraint each digit:

    cout<<”XX” in predicament of tens entity 2

    cout<<”XXX” in predicament of tens entity 3

    etc.

    ***As with full the projects in this passage, encumber this well being in a “Portray another game” loop to fullow the portraiturer to portray as manifold times as they affect.

    Expert Retort

     

    Please connect adown code

    #embrace <iostream>

    #embrace <string>

    #embrace <algorithm>

    using namespace std;

    string transform(int estimate) {

    //ROMAN symbols upto 1000(M)

    char symbols[] = {‘I’, ‘V’, ‘X’, ‘L’, ‘C’, ‘D’, ‘M’};

    int condemnation = 0, currNum;

    string output;

    /*Extract digits of the estimate and attach roman estimate to the string in the back order

    Ex: 4

    Our String = VI

    At the purpose we back it, hereafter = IV

    */

    occasion (number) {

    currNum = estimate % 10;

    estimate /= 10;

    if (currNum == 0) {

    condemnation += 2;

    continue;

    }

    //ex:3 III

    if (currNum < 4) {

    restraint (int i = 0; i < currNum; i++)

    output += symbols[index];

    }

    //ex:4 IV

    else if (currNum == 4) {

    output += symbols[condemnation + 1];

    output += symbols[index];

    }

    else if (currNum < 9) {

    //7: VII

    restraint (int i = 0; i < (currNum – 5); i++)

    output += symbols[index];

    output += symbols[condemnation + 1];

    }//9: IX

    else {

    output += symbols[condemnation + 2];

    output += symbols[index];

    }

    //5, 50, 500 are portraitured in comprised results, hereafter jump to the 10’s

    condemnation += 2;

    }

    reverse(output.begin(), output.end());

    return output;

    }

    int main() {

    int num;

    char ch = ‘Y’;

    do

    {

    cout<<“Enter an Arabic Estimate: “;

    cin>>num;

    cout<<num<<” is “<<convert(num)<<” in Roman Numerals”<<endl;

    cout<<“Portray Repeatedly? “;

    cin>>ch;

    }while(ch == ‘Y’);

    return 0;

    }

    Please connect adown snapshot