Question: Your program starts with a while or do-while loop with the condition that your input character is F or C; 1) Before and within the
Your program starts with a while or do-while loop with the condition that your input character is F or C;
1) Before and within the while loop, it prints "your name > Fahrenheit/Celsius Converter. Please enter F or C:" For example, if it is my program, it will print: Daniel David > Fahrenheit/Celsius Converter. Please enter F or C:
2) If you have any other input (other than F, f, C, or c), you inform the user that "The input is unknown!" and your program will quit the loop.
2. Within the loop, your program will use F, f, C, or c as selections in a switch statement. Actually, you can put "The input is unkown!" in the switch statement's default selection.
3. Within the corresponding switch selection, your program
1) prints "your name > Please enter a Fahrenheit degree number:" if you entered F or f; prints "your name > Please enter a Celsius degree number:" if you entered C or c.
2) reads the input number, which should be a "double" and should be passed as a parameter into the following corresponding function.
3) in case of F or f, call a function "double fc_converter(double);" with the input value; in case of C or c, call a function "double cf_converter(double);" otherwise, you inform the user "The input is unknown!" in the default selection.
4. In "double fc_converter(double);" you should use "if" to do the following.
1) if you enter a number in the range of -200 to +200, for example, "32", it will calculate according to the equation: C = FCR*(F - 32.00), where FCR is a pre-defined constant 0.556. Your variable should be in "double". After that, it will print the following before returning the Celsius degree:
32.00 F ==> 0.00 C
2) otherwise, it will print "Invalid Celsius temperature." and return a value according to the equation: C = sqrt(F).
5. Similarly, in "double cf_converter(double);" you should use "if" to do the following.
1) if you enter a number in the range of -200 to + 200, for example, "0", it will calculate according to the equation: F = CFR*C + 32.00, where CFR is a defined constant 1.8. After that, it will print the following before returning the Fahrenheit degree:
0.00 C ==> 32.00 F
2) otherwise, it will print "Invalid Fahrenheit temperature." and return a value according to the equation F = pow(C, 3).
6. After the switch, if your input is F, f, C, or c at the beginning,
1) print out the return value as: "The calculated value from the converter function is:
2) Loop back to Step 1.
7. For any other input at the beginning, your program exits the loop, and the program finishes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
