Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

C# C# Objects Loops and Final Touches Static Members

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points

I don't understand the last code challenge

I really don't understand what I'm doing here in the code challenge I've attempted to do it though I'm still struggling.

RightTriangle.cs
namespace Treehouse.CodeChallenges
{
    class RightTriangle
    {
        public static double CalculateHypotenuse
    }
}

4 Answers

Steven Parker
Steven Parker
231,236 Points

You've got a good start by declaring the function as returning a double. Now declare the arguments. The instructions say "The method should take two parameters of type double..."

Then for the body, they say "The Pythagorean theorem will come in handy.." You may need to look this up, it's just a math formula that will let you know what you need to do with the arguments to create the right result. Finally, return that result.

Steven Parker are you on social media? if yes what your handles?

Steven Parker
Steven Parker
231,236 Points

No, I'm not a social media user. But I do visit the forum here frequently.

Tojo Alex
PLUS
Tojo Alex
Courses Plus Student 13,331 Points
namespace Treehouse.CodeChallenges
{
    class RightTriangle
    {
        public static double CalculateHypotenuse
        {
                return double 
        }
    }
}
  // This is my code so far , now my question is about the math formula do I need to use it or write it in my code.
Joshua Thao
Joshua Thao
6,439 Points

using System; namespace Treehouse.CodeChallenges { class RightTriangle { public static double CalculateHypotenuse(double side1, double side2) { double hypotenuse;

        hypotenuse = //formula goes here

        return hypotenuse;
    }

}

}