C# C# Objects Methods Methods

Can 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?

Frog.cs
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
Steven Parker
181,132 Points

You 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.

thank 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
Steven Parker
181,132 Points

It looks like the type is missing now, but it needs to be declared as an integer:

        public bool EatFly(DistanceToFly distanceToFly)  // original with wrong type
        public bool EatFly(int distanceToFly)            // fixed

thank you, i finally figured it out

Steven Parker
Steven Parker
181,132 Points

Ramon Sharpe — Glad to help. You can mark a question solved by choosing a "best answer".
And happy coding!