Design a program that converts between Roman Numbers and decimal numbers, then implement that design in...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Design a program that converts between Roman Numbers and decimal numbers, then implement that design in C++. See the textbook: Programming Exercises P3.6, P4.12, and P4.13 as references. Our specifications for Roman Numbers is on the next page. Your program should: Display a friendly greeting to the user. Prompt the user for a string (either a decimal number or a Roman number) Accept that string. If the value entered is 0 or O, state the number of values converted and exit the program. Identify the type of number entered (Decimal or Roman). Test the string to ensure that it adheres to the required format. If the string does not adhere to the appropriate format, display a message explaining that the user should more carefully read the specifications and exit. Convert the input string to the desired output string by invoking a function. Display the appropriately-formatted output. Display the prompt again. Your program must include these four functions, with these prototypes: bool isvalidDecimalNumber (string s); isvalidRomanNumber (string s); string convertRomanToDecimal (string s); string convertDecimalToRoman (string s); bool You may make use of any other helper functions (such as the one recommended in P4.12) as you see fit. Note: Roman Numbers can be entered in upper and/or lower case. Sample Run (user input in bold): Welcome to Roman Number Conversion! Please enter a value to convert: MCMLXXVII MCMLXXVII (Roman) = 1977 (Decimal) Please enter a value to convert: 1977 1977 (Decimal) is MCMLXXVII (Roman) Please enter a value to convert: HELLO I did not understand input HELLO Please enter a value to convert: 0 2 numbers were converted (1 Decimal to Roman, 1 Roman to Decimal) Thank You for playing Roman Number Conversion! Submit two documents: the .cpp file and a screen shot of your program in action. Design a program that converts between Roman Numbers and decimal numbers, then implement that design in C++. See the textbook: Programming Exercises P3.6, P4.12, and P4.13 as references. Our specifications for Roman Numbers is on the next page. Your program should: Display a friendly greeting to the user. Prompt the user for a string (either a decimal number or a Roman number) Accept that string. If the value entered is 0 or O, state the number of values converted and exit the program. Identify the type of number entered (Decimal or Roman). Test the string to ensure that it adheres to the required format. If the string does not adhere to the appropriate format, display a message explaining that the user should more carefully read the specifications and exit. Convert the input string to the desired output string by invoking a function. Display the appropriately-formatted output. Display the prompt again. Your program must include these four functions, with these prototypes: bool isvalidDecimalNumber (string s); isvalidRomanNumber (string s); string convertRomanToDecimal (string s); string convertDecimalToRoman (string s); bool You may make use of any other helper functions (such as the one recommended in P4.12) as you see fit. Note: Roman Numbers can be entered in upper and/or lower case. Sample Run (user input in bold): Welcome to Roman Number Conversion! Please enter a value to convert: MCMLXXVII MCMLXXVII (Roman) = 1977 (Decimal) Please enter a value to convert: 1977 1977 (Decimal) is MCMLXXVII (Roman) Please enter a value to convert: HELLO I did not understand input HELLO Please enter a value to convert: 0 2 numbers were converted (1 Decimal to Roman, 1 Roman to Decimal) Thank You for playing Roman Number Conversion! Submit two documents: the .cpp file and a screen shot of your program in action.
Expert Answer:
Answer rating: 100% (QA)
The solution in c11 is as follows CODE include using namespace std Check whether input is number or ... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
In this assignment, you are writing a program that converts common texting abbreviations to English words to allow people like yours truly can understand. For the assignment, you are provided with a...
-
In this exercise, you will create a program that converts U.S. dollars to a different currency. The number of American dollars should always be an integer that is greater than or equal to zero. The...
-
Write a program that converts a Java file into an HTML file. In the HTML file, the keywords, comments, and literals are displayed in bold navy, green, and blue, respectively. Use the command line to...
-
You are the cashier employed at Tastee Limited. On November 30, 2020, you started with a float of $6,500 and at the end of the business day your cash in the cash till were as follows: Notes Coins...
-
Indicate whether each of the following statements is true or false by writing T or F in the answer column. 1. An employee may sue a third party for a work- related injury or illness, even if the...
-
(a) Derive Eqs. 9.179, and from these obtain Eqs. 9.180. (b) Put Eq. 9.180 into Maxwell's equations (i) and (ii) to obtain Eq. 9.181. Check that you get the same results using (i) and (iv) of Eq....
-
(a) A feather and a brick are falling freely in an evacuated tube. Is the magnitude of the gravitational force exerted by Earth on the feather larger than, smaller than, or equal to that exerted by...
-
Marotta Corporation has collected the following information after its first year of sales. Net sales were $1,600,000 on 100,000 units; selling expenses $240,000 (40% variable and 60% fixed); direct...
-
QUESTION ONE a) Distinguish between sale and agreement to sell b) Explain the rights of unpaid seller against the goods c) Explain the nature of the contract of hire purchase QUESTION TWO (5 marks)...
-
Select all that apply: Requisitioning an OTC item to use for script fulfillment includes: Purchasing the item through the Target POS Generating a Price Barcode using price inquiry Getting a Target...
-
Walts business building (adjusted basis of $50,000) is destroyed by fire on October 5, 2020. On November 17, 2020, he receives insurance reimbursement of $100,000 for the loss. Walt invests $80,000...
-
A 0.630-mH inductor and a 128- resistor are placed in series with a 24-V battery. How long will it take for the current to reach 67% of its maximum value? s What is the maximum energy stored in the...
-
SESSION DATE JUNE 21, 2024 15 To: Binh's Bins 672 Alleyway Drive Red Deer, AB T4R 2T4 BINH'S BINS - GENERAL JOURNAL Sylvan Motors 179 Towing Blvd., Red Deer, AB T4P 1S2 Date: June 15, 2024 Truck...
-
Solve the right triangle. 140 75 Find the length of the side adjacent to the given angle. (Round your answer to two decimal places.) 540.92 * Find the length of the hypotenuse. (Round your answer to...
-
NPV= -29,000 + 14,400 /(1+r) + 12,300/(1+r) 2 + 9,200/(1+r) 3 + 5,100/(1+r) 4 . What is the value of r?
-
in a period of 1 5 s , an elevator car which weighs 6 0 0 0 N including its passenger goes from the first floor to the third floor by covering a vertical distance of 3 6 m . what is the average power...
-
Complete the following program to find the multiplication of these two arrays. 2 3 4 12 1 1 0 10 1 0 1 4 1 c[3][2]= a[3][3]* b[3][2] int main() { int a[3][3], int b[3][2], c[3][2]={0}; int i,j,k; //...
-
A heat engine has a heat input of 3 Ã 104 Btu/h and a thermal efficiency of 40 percent. Calculate the power it will produce, in hp. Source 3 x 10 Btu/h 40% HE Sink
-
Trace a walkthrough of selection sort with these sets: a. 4 7 11 4 9 5 11 7 3 5 b. 7 6 8 7 5 9 0 11 10 5 8
-
What is an event object? An event source? An event listener?
-
In a travel simulation, Harry will visit one of his friends that are located in three states. He has ten friends in California, three in Nevada, and two in Utah. How do you produce a random number...
-
Use the numbers for the alcohol and tobacco category from the table in the Application "Goods with a Large Consumer Surplus Loss from Price Increases" to draw a figure that illustrates the roles that...
-
Change the answer given in the Challenge Solution for the short run rather than for the long run.
-
Because many consumers choose between coffee and tea, the coffee and tea demand functions depend on both prices. Suppose the demand curves for coffee and tea are where \(Q_{c}\) is the quantity of...
Study smarter with the SolutionInn App