Details of this Paper

Integer to Roman

Description

solution


Question

How can I write a c++ program that has the following;-given an integer, will print the string representation of the Roman;-accept input of one integer from the keyboard. program will output the Roman Numeral representation of the value.;-account for input of any integer value. However, the input must be between 1 and 5999, inclusive. that is, program must keep prompting the user until a satisfactory value is entered.;-use a string object to build the result value before displaying it to the user. Printing as you go will lose significant credit, there should be one cout statement for the resultant Roman numeral.;-use at least one switch, one do-while, and one while statement in your program;Additional Requirements;Min Pages: 1;Level of Detail: Show all work;Other Requirements: write a program that, given an integer, will print the string representation of the Roman;Numeral value, see Table 1 for help converting roman numerals to integers.;Table 1: Decimal Number to Roman Numeral Conversions;Decimal Number Roman Numeral;1 I;5 V;10 X;50 L;100 C;500 D;1000 M;To help in testing, there are many calculators available on the Internet (Google ?Roman Numeral? finds one;expeditiously). I strongly advise that you investigate several values, specifically the conversion of 4 and 9.;Input / Output;You are to accept input of one integer from the keyboard. Your program will output the Roman Numeral;representation of the value.;Specifications;? Your program must be robust. That is, it must account for input of any integer value. However, for our;purposes, the input must be between 1 and 5999, inclusive. That is, your program must keep prompting;the user until a satisfactory value is entered.;? You must use a string object to build the result value before displaying it to the user. Printing as you go;will lose significant credit, there should be one cout statement for the resultant Roman numeral.;See Chapter 8 in the texts for some basic manipulations of strings. However, know that if s is a;string, s += ?IV?, will append IV to the end of string s.;? Be careful handling specific Roman numeral values, for example, 4 = IV, 99 = XCIX, 98 =;XCVIII.;? You must use at least one switch, one do-while, and one while statement in your program, you;may use any other statements you wish.;Recommendations;? Write the code to convert from an integer to Roman numeral first. Assume ideal input and thoroughly;test the conversion code before handle robust input from the user. When writing the conversion code;begin only with numbers 1 through 10. This will allow you to handle the special cases involving 4 and 9;and then generalize to the tens (40 and 90) and hundreds (400 and 900).;? Be thorough in your testing by handling all boundary cases.

 

Paper#70240 | Written in 18-Jul-2015

Price : $22
SiteLock