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 trialRamon Sharpe
566 PointsCan someone walk me through this challenge?
I'm stuck on this challenge, I guess i'm not grasping how i'm supposed to accomplish this. Can anyone walk me through it so i can understand what i'm doing wrong?
namespace Treehouse.CodeChallenges
{
class Frog
{
public readonly int TongueLength;
public Frog(int tongueLength)
{
TongueLength = tongueLength;
}
public bool EatFly(DistanceToFly distanceToFly)
{
bool lunch = distanceToFly <= TongueLength;
return lunch;
}
}
}
2 Answers
Steven Parker
231,198 PointsYou are really close! The instructions said "It should take a single integer parameter ...", but you declared your parameter as type "DistanceToFly" (which has not been defined).
Once you fix the parameter type, you should pass the challenge.
Ramon Sharpe
566 Pointsthank you, i finally figured it out
Steven Parker
231,198 PointsRamon Sharpe — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!
Ramon Sharpe
566 PointsRamon Sharpe
566 Pointsthank you for you help, so just to be clear, the parameter is in the () of the method [EatFly (distanceToFly)] correct? assuming that is so , I have reworked it and i'm getting the same error. what am i doing wrong?
Steven Parker
231,198 PointsSteven Parker
231,198 PointsIt looks like the type is missing now, but it needs to be declared as an integer: