Shirlee is working with a measurement tool that reports measurements in centimet
ID: 3595480 • Letter: S
Question
Shirlee is working with a measurement tool that reports measurements in centimeters. Since Shirlee is unfamiliar with centimeters, she would like her centimeter measurements to be converted into yards, feet, and inches. She would also like the result to be properly rounded to the nearest inch. As an example, if the measurement is 312 centimeters, this should be converted to 3 yards, 1 foot, and 3 inches. (1 yard = 3 feet, 1 foot = 12 inches)
1. Identify the inputs and outputs of the problem.
2. Identify the processing needed to convert the inputs to the outputs.
HINT: (1) Convert centimeters to total number of inches first! (1 inch = 2.54 cm)
(2) To calculate rounded inches, you can make use of the following statement:
inches = static_cast<int> (fractional_INCH + 0.5);
3. Design an algorithm in pseudocode to solve the problem. Make sure to include steps to get each input and to report each output.
4. Identify two test cases other than the example given above. For each of the two test cases show what inputs you will use and calculate what your expected outputs should be.
5. Write the program to implement your algorithm. Test your program using your test cases. Did your program produce the values predicted in your test cases? Explain.
Explanation / Answer
Input : x centimeters
Output : a yards, b foot and c inches.
Shirlee will input x centimeters to the program and program will output it in the form of yards, foot and inches.
Note: Since no particular question is specified, I am soving 1st part as per chegg rules.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.