The procedure shown below checks whether its arguments represent a valid date in the Gregorian calendar (the one we use in the United States). The calendar was instituted in 1582, so only dates in that year or in the future are legal.
- Simplify the valid-date block and make it more readable by defining and using well-named helper procedures (hint: Is leap year?). When you are done, there should be more code than when you started, but it should be easier to understand.