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 trialTojo Alex
Courses Plus Student 13,331 PointsI 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.
namespace Treehouse.CodeChallenges
{
class RightTriangle
{
public static double CalculateHypotenuse
}
}
4 Answers
Steven Parker
231,271 PointsYou'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.
Tojo Alex
Courses Plus Student 13,331 Pointsnamespace 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.
Tojo Alex
Courses Plus Student 13,331 PointsI figured it out thanks
Joshua Thao
6,439 Pointsusing System; namespace Treehouse.CodeChallenges { class RightTriangle { public static double CalculateHypotenuse(double side1, double side2) { double hypotenuse;
hypotenuse = //formula goes here
return hypotenuse;
}
}
}
Dalin Nkulu
15,587 PointsDalin Nkulu
15,587 PointsSteven Parker are you on social media? if yes what your handles?
Steven Parker
231,271 PointsSteven Parker
231,271 PointsNo, I'm not a social media user. But I do visit the forum here frequently.