a) Program code is often written using procedures. Give THREE advantages of using procedures in
b) Write an algorithm (pseudocode or flowchart) for a procedure to validate the input of a date in
February in any year.
The date should be input in the form ddmmyyyy e.g. 07021998
You will need to store each numeric part of the date separately and validate each part.
Include a calculation to determine whether the year entered is a leap year and then check that day is
within the allowed range – in a leap year there are 29 days in February otherwise there are only 28 days in
February - e.g. 29021983 is not valid as there are normally only 28 days in February, however 29021984
is valid because it is a leap year.
Leap years are determined in the following way:
If the year is a century year (such as 1800, 1900, 2000) it is a leap year if it can be divided by 400.
If the year is not a century year then it is a leap year if it can be divided by 4.