The pseudo-code would be:
if (vacationDayDate.Year == year)
{
if({isHalfDay})
yearMonths[vacationDayDate.Month] += 0.5;
else // is full day
yearMonths[vacationDayDate.Month]++;
}
Or more succinctly:
if (vacationDayDate.Year == year)
{
yearMonths[vacationDayDate.Month] += {isHalfDay} ? 0.5 : 1.0;
}
7
solved How to make my calculation more accurate