Goal: In this module, you learned about functions. You will now write a program that uses two functions to convert from Celsius to Fahrenheit and vice versa. Write this program using functions. This...

1 answer below »

Goal: In this module, you learned about functions. You will now write a program that uses two functions to convert from Celsius to Fahrenheit and vice versa.


Write this program using functions. This is a requirement for this assignment.You will earn a grade of zero if you do not demonstrate the use of functions to do thisassignment.




Write a program that gives the user a menu to choose from –
1. Convert temperature input from the user in degrees Fahrenheit to degrees Celsius
2. Convert temperature input from the user in degrees Celsius to degrees Fahrenheit
3. Quit.





Formulae you will need:C = (5 / 9) * (F-32) and F = (9/5) * C + 32


1. Use functions to accomplish 1 and 2 above.
2. Use at least one function for each scenario (i.e. converting temperature from degrees Fahrenheit to degrees Celsius and from degrees Celsius to degrees Fahrenheit). You mustcall them from the mainfunction. You can use more functions if you see fit to do so.





Test the program with the following values:

68 degree F = 20 degree C
20 degree C = 68 degree F
-22 degree F = -30 degree C
0 degree C = 32 degree F





Deliverables:

Paste your code and screenshots of the output from running the program in a Word document, and attach it to yoursubmission. Submit just the one Word document.





Rubric:

1. Use of correctly functioning menu (10 points).
2. Correct use of at least one function for Scenario 1 (i.e. converting from F to C). (25
points)
3. Correct use of at least one function for Scenario 2 (i.e. converting from C to F). (25
points)
4. Code with appropriate comments (20 points).
5. Four screen shots showing the program works correctly. (20 points)
6. 10 bonus points for using more than four functions (excluding the main function) in the
entire program.

Answered Same DayApr 02, 2021

Answer To: Goal: In this module, you learned about functions. You will now write a program that uses two...

Arun Shankar answered on Apr 03 2021
158 Votes
Temperature convertor/program.cpp
#include
using namespace std;
// Function to accept
a temperature as the input
double get_input()
{
double input;
cout<<"Enter temperature: ";
cin>>input;
return input;
}
// Function to display the menu
void show_menu()
{
cout<<"\nMENU\n--------------";
cout<<"\n1. celcius to fahrenheit";
cout<<"\n2. fahrenheit to celcius";
cout<<"\n3. quit";
}
// Function to convert from fahrenheit to celcius
double fahrenheit(double celcius)
{
return 32+((9.0/5.0)*celcius);
}
// Function to convert from celcius to fahrenheit
double celcius(double fahrenheit)
{
return (fahrenheit-32)*(5.0/9.0);
}
int main()
{
int choice = 0;
while(choice!=3)
{
show_menu();
cout<<"\n\nEnter choice [1,2,3]: ";
...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here