Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

using System;

namespace CodeLou.CSharp.Week2.Challenge
{
Expand All @@ -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 <Ctrl>+<Shift>+B.
Console.WriteLine("Welcome to the Code Louisville C# week 2 code challenge!");
Console.WriteLine("Press <Enter> to begin...")
Console.WriteLine("Press <Enter> to begin...");
Console.ReadLine();

Console.WriteLine("This is the launch application for the first human mission to Mars.");
Expand All @@ -26,15 +26,26 @@ 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 numSeconds = Console.ReadLine();

// Task 4:
// Write a condition to test whether the number that they entered is less than or equal to zero.
// Call the IsLessThanOrEqualToZero() method below, passing the user's number as a parameter.
// 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(numSeconds, out iNumSeconds))
{
Console.WriteLine("Please enter a whole number.");
return;
}


if (IsLessThanOrEqualToZero(iNumSeconds))
{
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
Expand All @@ -44,6 +55,16 @@ 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(500);
}
Console.WriteLine("LIFTOFF!");
}


Console.WriteLine("Press <Enter> to exit...");
Console.ReadLine();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,8 @@
C:\Users\jfraney1\Source\Repos\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\bin\Debug\CodeLou.CSharp.Week2.Challenge.exe.config
C:\Users\Brian\CodeChallenges\Challenges\CS Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\bin\Debug\CodeLou.CSharp.Week2.Challenge.exe.config
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\bin\Debug\CodeLou.CSharp.Week2.Challenge.exe.config
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\obj\Debug\CodeLou.CSharp.Week2.Challenge.csprojResolveAssemblyReference.cache
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\bin\Debug\CodeLou.CSharp.Week2.Challenge.exe
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\bin\Debug\CodeLou.CSharp.Week2.Challenge.pdb
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\obj\Debug\CodeLou.CSharp.Week2.Challenge.exe
C:\Users\English\Source\Repos\C-Sharp-Weekly-Challenge\Challenges\Week2\CodeLou.CSharp.Week2.Challenge\CodeLou.CSharp.Week2.Challenge\obj\Debug\CodeLou.CSharp.Week2.Challenge.pdb
Binary file not shown.