Project: Ordinal Date (Revisited)
Write a function to compute the ordinal date. The function should have arguments for month, day and year. Write a second function to determine if the year is a leap year that is used by the first function. Use preconditions to validate the function arguments and postconditions to check the result. You can compute the ordinal date with the following formula:
- for January: d
- for February: d + 31
- for the other months: the ordinal date from March 1 plus 59, or 60 in a leap year
where the ordinal date from March 1 is: floor(30.6m-91.4)+d
and a year is a leap year if it is evenly divisible by 4 but not evenly divisible by 100 unless it is evenly divisible by 400.
See [[Ordinal Date]] and [[Leap Year]]