65
E X E R C I S E # 2 1 : V A L I D A T E D A T E
isValidDate(2005, 3, 29)
→
True
isValidDate(2005, 13, 32)
→
False
You can represent a date with three integers for the year, month, and day, but this doesn’t mean
that any integers represent a valid date. After all, there is no 13
th
month of the year or 32
nd
day of any
month. This exercise has you check if a year/month/day combination is valid, given that different
months have different numbers of days. You’ll use the solution you wrote for Exercise #20, ―Leap
Year‖ as part of the solution for this exercise, so finish Exercise #20 before attempting this one.
Dostları ilə paylaş: