C#

Steven Parker
Steven Parker
176,604 Points

Hints for C# Basics, Final Challenge, Task 2 of 2

Not a question, but hints in hopes that people will find it when they have a problem instead of creating their own very specific question (yet again).

*I'm creating this generic question in hopes that people will find it when they have a problem instead of creating their own very specific one (yet again).*The challenge asks: Add more input validation to the program by printing "You must enter a positive number." if the user enters a negative number.

You're sure you have a good answer, and perhaps have even tried building it elsewhere to test it, but it won't compile in the challenge and/or does not pass. What's wrong?

I'm creating this generic question in hopes that people will find it when they have a problem instead of creating their own very specific one (yet again).

2 Answers

Steven Parker
Steven Parker
176,604 Points

People often over-think this one and get too creative, and their answer is rejected for a variety of reasons (some which don't seem to make any sense).

Here are the secret "rules" you must follow for success on this one:

  • Your program must ask for and accept input ONE TIME ONLY
  • If the input validates, your program will print some "Yay!" messages and exit
  • If the input does not validate, it will print the error message and exit
  • Either way, it will exit
John Lukacs
John Lukacs
25,194 Points

I've tried all day to solve this is there any chance you can just give me the code