dannyrb

dannyrb

  • NA
  • 3
  • 0

Almost Got It Except For:

Feb 28 2005 3:51 PM
I am just learning C# and I seem to have ran into a brick wall. I have tried the documentation help and everything I try produces an error unless I leave out the Math.exp method and then it runs but the answer is wrong. This is the new formula for calculating wind chill. I need to raise the power of v(wind speed) to the 0.16 power and I'm stuck. The old formula used Math.sqrt to find the square root of v and I had no problem there. What am I overlooking? // The Formula: 35.74 + 0.6215T - 35.75(V "exp 0.16") + 0.4275T(V "exp 0.16") int t = int.Parse (textBox1.Text); // Temperature double v = double.Parse (textBox2.Text); // Wind Speed if (v < 2) belowTwo(); double c1 = 35.74; // c1 thru c5 are constants double c2 = 0.6215; double c3 = 35.75; double c4 = 0.4275; error: double c5 = 0.16; // c5 holds raise to the power of constant no overload for method> double power = Math.Exp (v,c5); 'Exp'takes '2' double s1 = c2 * t; // s1 thru s5 are the steps of precedence arguments double s2 = c3 * power; double s3 = c4 * t; // s3 holds the answer to 0.4275 * Temperature double s4 = s3 * power; double s5 = c1 + s1 + s4; double s6answer = s5 - s2; float roundedAnswer = System.Convert.ToSingle (s6answer); textBox3.Text = ("With this temperature & wind speed " + "it feels like: ") + roundedAnswer.ToString() + " (°F)"; Any suggestions would be nice. Thanks from Tripsalot and I think I'll be reeding this forum alot.

Answers (3)