Question

Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts...

Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts it to Celsius by subtracting 32 from the Fahrenheit value and multiplying the result by 5/9.

Display both values to one decimal place.

For example, if 88.5 degrees is input, the output would be: 88.5 F is 31.4 C

Answer in C#

(Posting incomplete code i have so far that wont run correctly.)

using System;
using static System.Console;
class FahrenheitToCelsius
{
static void Main()
{
double celsius;
WriteLine("Enter Fahrenheit temperature : \n");
double fahrenheit = Convert.ToDouble(ReadLine());
celsius = (fahrenheit - 32) * 5 / 9;
WriteLine("The original Fahrenheit temperature is " + fahrenheit);
WriteLine("The Equivalent Celsius temperature is " + Math.Round(celsius, 1));
}
}

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

using System;

using static System.Console;

class MainClass

{

public static void Main ()

{

double celsius;

Write("Enter Fahrenheit temperature: ");

double fahrenheit = Convert.ToDouble(ReadLine());

celsius = (fahrenheit - 32) * 5 / 9;

WriteLine("{0} F is {1} C", Math.Round(fahrenheit, 1), Math.Round(celsius, 1));

}

}

********************************************************************* SCREENSHOT ******************************************************

Add a comment
Know the answer?
Add Answer to:
Write a program named FahrenheitToCelsius that accepts a temperature in Fahrenheit from a user and converts...
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
  • 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.

  • 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.

  • C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have...

    C# Temp. Converter program. Create a Celsius and Fahrenheit Temperature Converter application. The application must have 2 Labels (each one of them assigned only to Celsius and Fahrenheit), 2 TextBoxes (each one of them assigned only to Celsius and Fahrenheit), only 1 Convert Button, 1 Clear Button, and 1 Exit Button. Also, 1 Error message label which will display the error messages. The application should only allow the user to enter the desired temperature just in one of the TextBoxes...

  • C# I am having trouble this program. So far my temperature converter program is converting temps...

    C# I am having trouble this program. So far my temperature converter program is converting temps from C to F. However, whenever I try to convert F to C, it's keep crashing and displaying an error message, which I can not figure it out and do not know how to fix it. Attached are two screenshots are of message. Do you know what is causing the issue? I would much appreciate your assistance. namespace Temp Conv { public partial class...

  • Task 1: Write a function that accepts temperature in degrees Fahrenheit and computes the corresponding value...

    Task 1: Write a function that accepts temperature in degrees Fahrenheit and computes the corresponding value in degrees Celsius (°C). The relation between the two is (TOF 32) Using your function convert 80 0F to Celsius (C)

  • FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice...

    FOR PYTHON Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom functionc_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a...

  • Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The...

    Write a Python program that can convert a Fahrenheit temperature to Celsius, or vice versa. The program should use two custom functions, f_to_c and c_to_f, to perform the conversions. Both of these functions should be defined in a custom module named temps. Custom function c_to_f should be a void function defined to take a Celsius temperature as a parameter. It should calculate and print the equivalent Fahrenheit temperature accurate to three decimal places. Custom function f_to_c should be a value-returning...

  • Write a program that inputs Celsius temperatures (use a void function), converts them to Fahrenheit (f...

    Write a program that inputs Celsius temperatures (use a void function), converts them to Fahrenheit (f = 9/5C + 32, use a value returning function) and prints whether it is a day for swimming or skiing (use a function). Include a loop in main that quits looping on -999. code in C++ please include a screen shot of the code as it is easier to read

  • What I need: Write a program named Averages that includes a method named Average that accepts...

    What I need: Write a program named Averages that includes a method named Average that accepts any number of numeric parameters, displays them, and displays their average. For example, if 7 and 4 were passed to the method, the ouput would be: 7 4 -- Average is 5.5 Test your function in your Main(). Tests will be run against Average() to determine that it works correctly when passed one, two, or three numbers, or an array of numbers. What I...

  • In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and...

    In java Se8 i am trying to write a program convert temperature between celsius, fahrenheit and kelvin, but i am stuck at how to return the proper result without chage the frame, and I cnould not figure out how to use those three settemp method. import java. uti1. Arrays public class Temperature different scale names/ public static Stringll scales -Celsius", "Fahrenheit", "Kelvin private double temperature private char scale; public Temperature (double temp temp 273. 15; this. scale-C if (temp <-273....

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
ADVERTISEMENT