Skip to content

Instantly share code, notes, and snippets.

@mallibone
Created February 4, 2017 10:50
Show Gist options
  • Save mallibone/6de3744a2b0811dc882f933d21238e59 to your computer and use it in GitHub Desktop.
Save mallibone/6de3744a2b0811dc882f933d21238e59 to your computer and use it in GitHub Desktop.
using System;
using System.Text;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
StringBuilder messageOfTheDay = new StringBuilder();
var currentDate = DateTime.Now;
if(currentDate.Day % 2 != 0)
{
messageOfTheDay.Append("Today is an odd Day, ");
}
else
{
messageOfTheDay.Append("Today all should be even, ");
}
switch(currentDate.DayOfWeek)
{
case DayOfWeek.Monday:
case DayOfWeek.Tuesday:
case DayOfWeek.Wednesday:
case DayOfWeek.Thursday:
case DayOfWeek.Friday:
messageOfTheDay.Append("that being said you should be working...");
break;
case DayOfWeek.Saturday:
case DayOfWeek.Sunday:
messageOfTheDay.Append("yay it's the Weekend!!!");
break;
default:
throw new InvalidOperationException("This program only knows the 7 weekdays....");
}
Console.WriteLine(messageOfTheDay.ToString());
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment