The George Washington University
School of Engineering and Applied Science
Department of Electrical Engineering and Computer Science
CSci 51 -- Fall 1998
Project #6
Due Date: start of class, Tuesday, 27 October 1998

The purpose of this project is to help you get more familiar with loops and packages, and to introduce PROCEDUREs and TASKs.

Part One: Using A PROCEDURE

In Part One you use the DayWeek package to create a disk file called calendar.dat. Your program will prompt the user for a starting month/year pair and an ending month/year pair, then display a line for each day in the given range. Enumeration types are to be used for the month and day abbreviations. For example, if the user enters

MAR 1997
APR 1997

as the starting and ending months, the file will contain, after the program is done, 61 lines. The first line will say

SAT MAR 1 1997

and the last line will say

WED APR 30 1997

Of course, if the user enters different years for the starting and ending values, the file will be much larger! Design your algorithm carefully before even thinking about code.

Your program should use a PROCEDURE named proc_display_month. This PROCEDURE will display all the days of a single month. See the specification below:

PROCEDURE proc_display_month (the_year : IN Natural; the_month : IN Natural; the_days : IN Natural);

To obtain a file output of your program, use the redirection character ">" and do not use "gexecute" command. Instead, use the example given below.

proj_06p.exe >calendar.dat

Part Two: Using Two TASKs

Replace the PROCEDURE in Part One with two TASKs running concurrently. Create the TASK TYPE task_display_month. Each TASK will display all the days of a single month. See the specification below:

TASK TYPE task_display_month (the_year : Natural; the_month : Natural; the_days : Natural);

There is only one TASK BODY definition given in the program. Use a DECLARE block, as shown below, to declare the two tasks. Also, note that the number of days per month varies from month to month.

DECLARE         --  Create one task per month
     task_one : task_display_month (the_year  => year_current,
                                    the_month => month_current,
                                    the_days  => total_days_in_month);

In Part Two only, start the date range on an odd numbered month (e.g., Jan, Mar, etc), and end the date range with an even numbered month (e.g., Oct, Dec, etc.). Use redirection to obtain a file output of your program.

Do not do a case study for Part Two. Do a case study for Part One only.