Question

For this assignment you will create a program converting Fahrenheit temperatures to Celsius temperatures. The formula...

For this assignment you will create a program converting Fahrenheit temperatures to Celsius temperatures.

The formula for converting a temperature from Celsius to Fahrenheit is:

F = C x 1.8 + 32, where F is the Fahrenheit temperature and C is the Celsius temperature.

Write a function named Fahrenheit that accepts a Celsius temperature as an argument and returns the temperature converted to Fahrenheit. Demonstrate the function by accepting a Celsius temperature from a user and displaying the temperature converted to Fahrenheit. Be sure to include comments throughout your code where appropriate.

Complete the C++ code

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note: Could you plz go through this code and let me know if u need any changes in this.Thank You
_________________

#include <iostream>

#include <climits>

using namespace std;

//function declarations

double fahrenheitToCelsius(double fahrenheit);

double getTemperature();

int main()

{

//Declaring variables

double fahrenheit,celsius;

  

//Calling the functions

fahrenheit=getTemperature();

celsius=fahrenheitToCelsius(fahrenheit);

  

//Displaying the output

cout<<fahrenheit<<" Fahrenheit(F) is "<<celsius<<" Celsius(C)."<<endl;

return 0;

}

//This function will get the input enetred by the user

double getTemperature()

{

double f;

cout<<"Enter temperature (in Fahrenheit F):";

cin>>f;

return f;

}

//This function will convert the fahrenheit to celsius

double fahrenheitToCelsius(double fahrenheit)

{

//converting fahrenheit to celsius

return (fahrenheit-32)*5.0/9.0;

}

___________________

Output:

_______________Could you plz rate me well.Thank You

Add a comment
Know the answer?
Add Answer to:
For this assignment you will create a program converting Fahrenheit temperatures to Celsius temperatures. The formula...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • This project is for my intro to C++ class. Below is the wording for the project....

    This project is for my intro to C++ class. Below is the wording for the project. "In this module, you learned about creating functions in C++ and how to combine functions with the concepts covered in previous modules to solve problems. For this assignment you will create a program converting Fahrenheit temperatures to Celsius temperatures. The formula for converting a temperature from Celsius to Fahrenheit is: F = C x 1.8 + 32, where F is the Fahrenheit temperature and...

  • C++ Code needed    Celsius Temperature Table The formula for converting a temperature from Fahrenheit to...

    C++ Code needed    Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is C =5/9(F -32) where F is the Fahrenheit temperature and C is the Celsius temperature. Write a function named celsius that accepts a Fahrenheit temperature as an argument. The function should return the temperature, converted to Celsius. Demonstrate the function by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.

  • 7. Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is the...

    7. Celsius Temperature Table The formula for converting a temperature from Fahrenheit to Celsius is the Fahrenheit temperature and C is the Celsius temperature. Write a func- he func- tion named celsius that accepts a Fahrenheit temperature as an argument. I tion should return the temperature, converted to Celsius. Demonstrate t he function by calling it in a loop that displays a table of the Fahrenheit temperatures 0 through 20 and their Celsius equivalents.

  • In Python, write a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as...

    In Python, write a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows: F=(9/5)C+32 The program should ask the user to enter a temperature in Celsius, then display the temperature converted to Fahrenheit.

  • Write a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows: F=95C+32...

    Write a program that converts Celsius temperatures to Fahrenheit temperatures. The formula is as follows: F=95C+32 The program should ask the user to enter a temperature in Celsius, and then display the temperature converted to Fahrenheit. I'm doing this on Python.

  • IN JAVA…Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user should be...

    IN JAVA…Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user should be able to enter a Celsius temperature, click a button, and then see the equiva-lent Fahrenheit temperature. Use the following formula to make the conversion: F = (9/5)C + 32 F is the Fahrenheit temperature and C is the Celsius temperature. Instead of only converting from Celsius to Fahrenheit, also convert from Fahrenheit to Celsius depending on the user's choice. Some hints: Use JTextField and...

  • (in python) Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user s......

    (in python) Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user s... Write a GUI application that converts Celsius temperatures to Fahrenheit temperatures. The user should be able to enter a Celsius temperature, click a button, and then see the equivalent Fahrenheit temperature. Use the following formula to make the conversion ( F=9/5 C + 32) where F is the Fahrenheit temperature and C is the Celsius temperature

  • Write a program that displays a table of Celsius temperatures 0 through a number entered by...

    Write a program that displays a table of Celsius temperatures 0 through a number entered by the user and their Fahrenheit equivalents as in the figure below. The formula for converting a Celsius temperature to a Fahrenheit temperature is: F = 9 / 5 * C + 32 where F is the Fahrenheit temperature and C is the Celsius Temperature. Your program must use a 'for' loop. Display all temperatures to one decimal place. Write a program that displays a...

  • Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin...

    Temperature Converter Create a temperature conversion program that will convert the following to Fahrenheit: Celsius Kelvin Newton Your program should take a character which represents the temperature to convert from and a value to be converted to using the following specification: C - Celsius K - Kelvin N - Newton In addition your program should take in the following character to exit the program: X - eXit the program The numeric input for your program should be of type double....

  • in matlab Fahrenheit and Celsius are related by equation: TeT 32)/1.8 Create a function called tempConv...

    in matlab Fahrenheit and Celsius are related by equation: TeT 32)/1.8 Create a function called tempConv that will convert temperature between Fahrenheit and Celsius The function should have two input parameters: one is a single temperature in degrees and the other one is the input temperature scale character 'C'or 'F The function should return the converted temperature as variable temp

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT