Add error handling to year day functions.

Exercise 5-8.
Change year day functions to use pointers.

Exercise 5-9.