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 trialIdan shami
13,251 PointsI dont understand how to fix this compiler error : FrogStats.cs(11,73): error CS1061: Type `Treehouse.CodeChallenges.Fro
FrogStats.cs(11,73): error CS1061: Type Treehouse.CodeChallenges.Frog' does not contain a definition for
tongueLength' and no extension method tongueLength' of type
Treehouse.CodeChallenges.Frog' could be found. Are you missing an assembly reference?
Frog.cs(3,18): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
namespace Treehouse.CodeChallenges
{
class FrogStats
{
public static double GetAverageTongueLength(Frog[] frogs)
{
for(int i = 0;i < frogs.Length;i++)
{
Frog frog = frogs[i];
double TongueLengthTotel = TongueLengthTotel + frogs[i].tongueLength;
double TongueLengthAvrage = TongueLengthTotel/frogs.Length;
return TongueLengthAvrage;
}
}
}
}
namespace Treehouse.CodeChallenges
{
public class Frog
{
public double TongueLength { get; }
public Frog(double tongueLength)
{
TongueLength = tongueLength;
}
}
}
2 Answers
Steven Parker
231,198 PointsThat particular error is caused by spelling "TongueLength" with a lower-case "t" in "frogs[i].tongueLength
". But you have a few other issues to address. Here's a few hints:
- declare the variables before the loop
- accumulate the total inside the loop
- calculate and return the average after the loop
Idan shami
13,251 Pointsthanks