Question: Introduction: This exercise will help you to solve a problem by breaking it into smaller sub-tasks. As in the previous exercise, we will also solve


Introduction: This exercise will help you to solve a problem by breaking it into smaller sub-tasks. As in the previous exercise, we will also solve a problem that has a repetitive element a single procedure that needs to be repeated two or more times. In future labs, we will enclose the repetitive portion of the procedure in a loop to execute it a set number of times-but we are not there yet. Program Exercise: In this exercise, your program will convert a measurement in inches to its equivalent measurement in yards, feet and inches. The user will input the inches value via the keyboard. The program should convert that value into the equivalent yards, feet and inches-with the largest number of yards calculated first, then the largest number of feet calculated from what remains after yards are removed, and then the remaining inches after the feet are removed. For example, if the user inputs a value of 123 inches the calculated output would be: 3yard(s),1feet(foot),and3inch(es) To arrive at these values, you have to do the following set of operations shown below. Remember that integer division (a/b) results in the quotient of a divided by b, and the modulus operation (a%b) results in the remainder of a divided by b. 1. 123/36 equals 3 (the number of full yards that can be taken out of 123 inches) 2. 123%36 equals 15 (the remaining inches after the 3 yards are removed) 3. 15/12 equals 1 (the number of full feet that can be taken out 15 inches) 4. 15%12 equals 3 (the number of remaining inches after the one foot is removed) Your program should do the following: 1. Center the titles for programmer name, course and exercise number on the output screen (the output screen width is 80 columns). Use divider lines to make you output look nice. 2. Prompt the user to input inches to be converted. If the user inputs a negative value for inches, turn that into a positive value and continue with the conversion. I show this in the sample output below. 3. Calculate the yards, feet and inches for the input inches. 4. Accumulate total number of inches input by the user (to be used in a final calculation) 5. Output the calculated yards, feet, inches result to the screen in a column format (example shown below). Page 1 of 2 - CST113Ex3Fall_new 6. Repeat this procedure for the second measurement. 7. Output the total yards, feet and inches. This requires a separate calculation performed on the total inches value. 8. Your output should look similar to this (arrange it how you wish, but you should have all of the same pertinent information). Requirements: - Create constants for any values that don't change in your program. Conversion factors are a good use of constants. For example: const int INCHES_PER_YARD = 36; - Create constants for the divider symbol and screen width which you will use in the creating of a divider line. - Reuse the input variables for each input (this is necessary when using a loop to repeat processes, which will be done in the future). - Fill in the IPO where words are missing. - Comment your code using keywords
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
