Write a program that will convert: • Degrees Fahrenheit to Degrees Celsius. The
ID: 3641482 • Letter: W
Question
Write a program that will convert:• Degrees Fahrenheit to Degrees Celsius. The formula is: C = 5/9*(F-32)
• Degrees Celsius to Degrees Fahrenheit. The formula is: F = 9/5 * C + 32
• Degrees Celsius to Degrees Kelvin. The formula is: K = C + 273.15
• Degrees Kelvin to Degrees Celsius. The formula is: C = K – 273.15
Your program needs to display a menu as follows:
1. Fahrenheit 2 Celsius
2. Celsius 2 Fahrenheit
3. Celsius to Kelvin
4. Kelvin to Celsius
5. Exit
If the user enters 5 the program needs to thank the user and terminate. If the user enters any other menu option, then your program needs to gather some data from the user and call the appropriate function. For example, if the user enters 2, then the program needs to prompt the user for the upper range of celsius temperature. You need to capture this information from the user and then call the function celsius2fahrenheit “upper range” number of times (use loop of your choice) passing the loop counter as an argument (celsius) to the function. The function will perform the necessary conversion according to the above converstion table and return the eqivalent of Celsius in Fahrenheit. The program then needs to print the range as a simple table of values (from 1 thorugh the “upper range”)
Your program will need to do the same for any other conversion the user chooses.
You need to write the following functions:
• fahrenheit2Celsius
• celsius2Fahrenheit
• celsius2Kelvin
• kelvin2Celsius
• displayMenu
Use pass by value, pass by reference, and function return types as you see appropriate. You can assume the user will enter positive values for the “upper range”. For the menu choices, you can assume the user will enter integers that may or may not be in the range 1 through 5.
Explanation / Answer
#include #include float Fahrenheit2Celsius(int F) { float C = (float)5/9*(F-32); return C; } float Celsius2Fahrenheit(int C) { float F = (float)9/5 * C + 32; return F; } float Celsius2Kelvin(int C) { float K=(float)C + 273.15; return K; } float Kelvin2Celsius(int K) { float C=(float)K + 273.15; return C; } void displayMenu() { coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.