The participation in the challenges seems to have dropped off, maybe the recent ones where a little to challenging? So let's go back to our roots and do a simple one.
Write a non-recursive version of the following code.
Public Function AddWorkDays( D As Date, X As Integer ) As Date Return AddWorkDays( D , X , If( ( X < 0 ) , -1 , 1 ) ) End Function Private Function AddWorkDays( D As Date, X As Integer , A As Integer ) As Date If D.DayOfWeek = DayOfWeek.Saturday Then D = D.AddDays(A) If D.DayOfWeek = DayOfWeek.Sunday Then D = D.AddDays(A) Return If( ( X = 0 ), D , AddWorkDays( D.AddDays( A ) , ( X - A ) , A ) ) End Function
Edit: Use Recursive Function in Post# 4 instead.
The purpose of the code is to return the next (or previous) work day, With Saturday and Sunday being non-work days.
- Frameworks required.
- vb.net submissions are preferred.
- SourceCode must be in spoilered code tags.
If you don't want to reveal your code, then don't submit a submission.
- If you like you can include a Zip-File of the project / executable.
This post has been edited by AdamSpeight2008: 05 May 2013 - 02:56 PM