I don't think the results differ. Just the "analysis". Since the code is provided, you - or others - may compare results.
In the arena of "analysis", the 'old folks" see that your reporting period (wheather time sheets, expense reports or other ilk of periodic doings) basically ends on Saturday. So, the "old folks" think ' ... we neeed to know how many saturdays are in the period ... ' as thee needs to be a 'reporting period' for every such event (Saturday). Then you add the minor addition / exception. If there is PART of a week within the period (the month), It also is counted as a reporting period. Since the counting of Saturdays will include any partial week periods at the start of the period, the 'old folks' think that we only need to know wheather the month ends on a saturday, because if it does, we have already counted it, otherwise there is some period between the last 'counted' Saturday and the end of the period which needs to included.
To actually "analyse" the problem, we could state:
[tab]All months have at least 4 Saturdays.
[tab]The number of days in a Month range from 28 to 31
[tab]For months with 29 days, If the Month Starts on Saturday, there is an extra Saturday.
[tab]For months with 30 days, there is an extra Saturday if the Month starts on or after Friday.
[tab]For months with 31 days, there is an extra Saturday if the Month starts on or after Thursday
Using these rules, 'old folks' could build a routine which never actually calculated the number of saturdays within the period (month), but just used the rules to determine the value. This process would still need to determinsethe "extra" which might be present at the end of the month, however this is always present unless the period (month) ends on the Saturday, so the logic calculation for this would be the same.
A seperate approach might be just to analyse the actual frequency of occurance of the numbers of periods for your process. It would reveal that the majority (~ 75%) of the months have 5 reporting periods. This approach would simply start with the 'assumption' of the 5 periods and adjust for the exceptions.
MichaelRed
mred@att.net
There is never time to do it right but there is always time to do it over