There may indeed be an algorithm, but I bet you could figure one out with some thought.
X is the current date.Y is the number of days to add to it. First, every five days in the "delay" (Y) results in a full weekend being passed over. You're left, then, with figuring out whether or not adding the remainder (Z = Y mod 5 = 0..4) will pass a weekend. The answer depends on Z and the day of week that X falls on.
For example, if X is a Wednesday and Z is 3 (Y is 3 or 8 or 13 or 18 ...), then a weekend will be passed.
You should be able to create a simple hard-coded two-dimensional matrix of the number of days to add based on X's day of week and Z. The value at the intersection is 0, 1 or 2 depending on whether adding Z to X lands on a weekday, Sunday or Saturday, respectively.
Oh, that's not entirely correct based on your problem. If the final date lands on a Sunday, from your description the date should be bumped to Tuesday as bumping it only to Monday means counting Saturday as a working day. Actually, all cases that pass a weekend should simply be bumped by two days.
Thus, you only need to note in the matrix whether or not a weekend is passed or hit:
And of course, looking at the
pattern in the matrix screams "simplify!" -- it can be reduced to a simple expression: "boolean weekendHit = xDayOfWeek + zRemainder >= 7". Note that xDayOfWeek is in [1,7] (1 = Sunday, 7 = Saturday -- adjust if I'm mistaken) and zRemainder is in [0,4].
I'll leave coallescing it into a final formula up to you.