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 trialSean Brannon
596 PointsNot sure what i am doing wrong here, keep getting error.
i keep getting the same error every time and i cant figure out why.
Program.cs(55,27): error CS0246: The type or namespace name `FormatExecption' could not be found. Are you missing an assembly reference?
using System;
namespace Treehouse.FitnessFrog { class Program { static void Main() { int runningTotal = 0;
bool keepGoing = true;
while(keepGoing)
{
// Prompt user for minutes exercised
Console.Write("Enter how many minutes you exercised or type \"quit\" to exit: ");
string entry = Console.ReadLine();
if(entry == "quit")
{
keepGoing = false;
}
else
{
try
{
// Add minutes exercised to total
int minutes = int.Parse(entry);
if(minutes <= 0)
{
Console.WriteLine(minutes + " is not an acceptable value.");
continue;
}
else if(minutes <= 10)
{
Console.WriteLine("Better than nothing, am I right?");
}
else if(minutes <= 30)
{
Console.WriteLine("Way to go hot stuff!");
}
else if(minutes <= 60)
{
Console.WriteLine("You must be a ninja warrior in training!");
}
else
{
Console.WriteLine("Okay, now you're just showing off!");
}
runningTotal = runningTotal + minutes;
}
catch(FormatExecption)
{
Console.WriteLine("That is not valid input.");
continue;
}
// Display total minutes exercised to the screen
Console.WriteLine("You've entered " + runningTotal + " minutes.");
}
// Repeat until user quits
}
Console.WriteLine("Goodbye");
}
}
}
1 Answer
Martin Zarate
10,723 PointsOne of the great things about error codes is that you can Google it to find out more information, you are getting error code CS0246, a quick search finds this documentation:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/compiler-messages/cs0246
I hope this helps, cheers.
Sean Brannon
596 PointsSean Brannon
596 PointsWell the link itself helped me know what the error meant. so i will be sure to google the error codes from now on. but i solved it while typing my response to you, turns out i spelled Exception as Execption.