From e43ec44401525a9511575f25b7255cb89cece3e6 Mon Sep 17 00:00:00 2001 From: bluerman Date: Fri, 16 Sep 2016 15:18:12 -0400 Subject: [PATCH] Revert "Added solution for Week2 challenge." --- .../CodeLou.CSharp.Week2.Challenge/Program.cs | 24 ++++--------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/Challenges/Week2/CodeLou.CSharp.Week2.Challenge/CodeLou.CSharp.Week2.Challenge/Program.cs b/Challenges/Week2/CodeLou.CSharp.Week2.Challenge/CodeLou.CSharp.Week2.Challenge/Program.cs index 5eaa02e..ade6c98 100644 --- a/Challenges/Week2/CodeLou.CSharp.Week2.Challenge/CodeLou.CSharp.Week2.Challenge/Program.cs +++ b/Challenges/Week2/CodeLou.CSharp.Week2.Challenge/CodeLou.CSharp.Week2.Challenge/Program.cs @@ -1,4 +1,4 @@ -using System; //<-- Added using statement to solve Task 1. + namespace CodeLou.CSharp.Week2.Challenge { @@ -16,7 +16,7 @@ static void Main(string[] args) // Hint: In Visual Studio, you can build the project by selecting "Build Solution" from the // build menu, or by pressing ++B. Console.WriteLine("Welcome to the Code Louisville C# week 2 code challenge!"); - Console.WriteLine("Press to begin..."); //<-- Added semicolon to solve Task 2. + Console.WriteLine("Press to begin...") Console.ReadLine(); Console.WriteLine("This is the launch application for the first human mission to Mars."); @@ -26,7 +26,7 @@ static void Main(string[] args) // Capture the number of seconds that the user would like to count down before liftoff. // Hint: You should use another method of the Console class and store the output into a // variable to use later. - var strNumSeconds = Console.ReadLine(); //<-- Captured user input into variable to solve Task 3. + // Task 4: // Write a condition to test whether the number that they entered is less than or equal to zero. @@ -34,14 +34,7 @@ static void Main(string[] args) // If the result is true, write "Please enter a positive number." to the console. // Hint: The input that you captured is currently a string type. You will have to "parse" it // as a different type in order to pass it to the IsLessThanOrEqualToZero function. - int iNumSeconds; - if (!int.TryParse(strNumSeconds, out iNumSeconds) || IsLessThanOrEqualToZero(iNumSeconds)) - { - //In the line above, we're testing to see if the input was both numeric, and positive. The same - //validation message is applicable in either case. Sometimes, you might want want to be more - //specific about the nature of the invalid data, to be more user-friendly. - Console.WriteLine("Please enter a positive number."); - } + // Task 5: // Add an "else" block to the condition from Task 4. This should be run in the case that the @@ -51,15 +44,6 @@ static void Main(string[] args) // "for". You can choose whichever you'd like to solve the task. The Microsoft // Developer Network (MSDN) website contains all of the documentation for C#. If you want // to learn more about loops, visit https://msdn.microsoft.com/en-us/library/32dbftby.aspx. - else - { - for (var i = iNumSeconds; i > 0; i--) - { - Console.WriteLine(i); - System.Threading.Thread.Sleep(1000); //<-- Pause execution for one second. - } - Console.WriteLine("LIFTOFF!"); - } Console.WriteLine("Press to exit..."); Console.ReadLine();