Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

NEEDED IN BASIC C# Create a C# application to convert temperature from Fahrenhei

ID: 3668504 • Letter: N

Question

NEEDED IN BASIC C#

Create a C# application to convert temperature from Fahrenheit to Celsius. This application has two methods: Main and ToCelsius, both of them static. In Main, the user is asked to enter the temperature in Fahrenheit. Main then calls ToCelsius and passes the Fahrenheit temperature as an argument.

ToCelsius uses the following formula to calculate the Celsius temperature: c = 5.0 / 9.0 * (f – 32)

The Celsius temperature is returned to Main and then displayed in the console window

Explanation / Answer

using System.IO;
using System;

class Program
{
static double ToCelcius(double f)
{
double c = 5.0/9.0*(f - 32);

return c;
}
static void Main()
{
double f,c;
Console.WriteLine("Enter the Temperature in Fahrenheit (°F) : ");
f = double.Parse(Console.ReadLine());
c=ToCelcius(f);
Console.WriteLine("the tempature in Celicus is {0}", c);
Console.ReadKey(true);
}
}