Thursday, December 20, 2012

What a year. Sometimes is difficult to keep up with technology. It is a great thing that developers have a good community that shares and great learning tools like Pluralsight. Merry Christmas and happy New Year.

This is my version of 12 days of Christmas. Copy in a console application and tell me what you think. (Besides than I am crazy)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TwelveDaysOfChristmas
{
    class Program
    {
   
        static void Main(string[] args)
        {
            Console.WriteLine(TwelveDaysOfChristmas(1,""));
            Console.ReadLine();
        }
        private static string  TwelveDaysOfChristmas(int day,string Screen)
        {
            Screen = Screen + String.Format("On the {0} days of Christmas my Pluralsight gave to me \r\n",getDay(day));
            if (day >= 12)   
                Screen = Screen + "Twelve (courses) of Javascript";         
            if (day >= 11) Screen = Screen + "Eleven (courses) of LINQ + NodeJS + Security \r\n";
            if (day >= 10) Screen = Screen + "Ten courses of debugging \r\n";
            if (day >= 9) Screen = Screen + "Nine (courses) of Entity Framework \r\n";
            if (day >= 8) Screen = Screen + "Eight courses of TFS \r\n";
            if (day >= 7) Screen = Screen + "Seven (courses) of WCF \r\n";
            if (day >= 6) Screen = Screen + "Six courses of architecture \r\n";
            if (day >= 5) Screen = Screen + "FIVE (courses) of JQUERY \r\n";
            if (day >= 4) Screen = Screen + "Four (courses) of C# \r\n";
            if (day >= 3) Screen = Screen + "Three (courses) of CSS \r\n";
            if (day >= 2) Screen = Screen + "Two (courses) of XML \r\n";
            if (day == 1)
                Screen = Screen + "A course of RUBY and HTTP \r\n";
            else
            {
                Screen = Screen + "And a course of RUBY and HTTP \r\n";
               
            }
            day += 1;
            if (day > 12)
                return Screen;
            return TwelveDaysOfChristmas(day,Screen);
        }
        private static string  getDay(int day)
        {
            string DayToReturn="";
            switch (day){
                case 1:
                   DayToReturn = "first";
                   break;
                case 2:
                   DayToReturn = "second";
                   break;
                case 3:
                   DayToReturn = "Third";
                   break;
                case 4:
                   DayToReturn = "Fourth";
                   break;
                case 5:
                   DayToReturn = "Fifth";
                   break;
                case 6:
                   DayToReturn = "Sixth";
                   break;
                case 7:
                   DayToReturn = "Seventh";
                   break;
                case 8:
                   DayToReturn = "Eight";
                   break;
                case 9:
                   DayToReturn = "ninth";
                   break;
                case 10:
                   DayToReturn = "Tenth";
                   break;
                case 11:
                   DayToReturn = "Eleventh";
                   break;
                case 12:
                   DayToReturn = "Twelfth";
                   break;
            }
            return DayToReturn;
        }

  
    }
}

No comments:

Post a Comment