Solution for problem 19 using java's built in Calendar