Write a method that will convert a temperature in Fahrenheit to Kelvin. The meth
ID: 3830620 • Letter: W
Question
Write a method that will convert a temperature in Fahrenheit to Kelvin. The method will be given the temperature in Fahrenheit, and must return the temperature in Kelvin. The formula for converting from Fahrenheit to Kelvin is: Kelvin = 5/9 times (Fahrenheit - 32) + 273.15 using System; namespace CsharpMidterm {class Class 1 {[STAThread] static void Main (string[] args) {HelperClass hc = new HelperClass(); Console.WriteLine (hc.Convert (95.9));//prints 308.65 Console.WriteLine (hc.Convert (35.6));//prints 275.15 Console.WriteLine (hc.Convert (32));//prints 273.15}}} class HelperClass {public _____ Convert (_____) {}}Explanation / Answer
class HelperClass
{
// method to convert fahrenheit to kelvin
// return type double
public double Convert(double temperature)
{
// perform calculations
double kelvin = ( (5.0/9)*(temperature-32) ) + 273.15;
// return result
return kelvin;
}
}
Related 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.