Pascal Programming Assignment #1

Due: Thursday, September 29th, 2005

 

Part (a)

Write a function whose parameters are a month of type MonthAbbrev and a year in the range from 1538 through 1999 and whose

return value is the number of days in the month.  Remember that February has 28 days, except in a leap year, when it has 29.  A leap year is one in which the year number is divisible by 4, except for centesimal years (those ending in 00);  these centesimal years are not leap years unless the year number is divisible by 400.  Thus 1950 and 1900 are not leap years, but 1960 and 1600 are.

 

Part (b)

Use the function of Part (a) in a program to read two dates in the form mm dd yyy  (such as 7 4 1776 and 1  1 1992) and  calculate the number of days that have elapsed between the two dates. (the function is not used to do the reading,  it is used to do the calculating).

 

Note:

You need the standard heading.

You need the standard descriptions

You need to comment about the language  (you may comment about what your program is doing too)

You need to introduce your program to the user. (I strongly suggest using a procedure to do this)

You need to tell the user when the program has ended.

 

Your program should check for out of range values (a day of 43 or a year of 1212) but does not have to check for improper data such as 15h8).

 

Deliverables: 

Printout

Disk with executable and source files in root