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 trial

C#

James Mackey
PLUS
James Mackey
Courses Plus Student 994 Points

Line 16. I cant figure out what is wrong with this program

I think there is a problem with recognizing "quit"

Sam Baines
Sam Baines
4,315 Points

You need to post your code here so that we can see what you have written. Most likely I am guessing you need to either change an input string from the user to all lowercase to get it to work with the conditional and match 'quit' or you have some syntax error elsewhere.

James Mackey
James Mackey
Courses Plus Student 994 Points

using System;

namespace Treehouse.FitnessFrog { class Program { static void Main() {

          int runningTotal = 0;
          bool keepGoing = true;

          while (keepGoing)
          {
            // Prompt the 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 
          {

          int minutes = int.Parse(entry);

            if(minutes <=10)
            {
              Console.WriteLine("Better than nothing, 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 (minutes >=60)
            {
              Console.WriteLine("Ok now you are just showing off!!");
            }
          }

          runningTotal = runningTotal + minutes;

          // Add minutes exercised to total
          // Display total minutes exercised to the screen

          Console.WriteLine("You've entered " + runningTotal + "                 minutes");
          }
          // Repeat until the user quits
          }

         Console.WriteLine("GoodBye!");
  }

}

Jeremy McLain
Jeremy McLain
Treehouse Guest Teacher

What is the text of the error you are getting?