
The purpose of this project is to help you get more familiar with loops and packages, and with creating and writing output text files.
Your project is to 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 write, into the external file, 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
APR 1993 MAY 1993
as the starting and ending months, the file will contain, after the program is done, 61 lines. The first line will say
THU APR 1 1993
and the last line will say
FRI MAY 31 1993
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.
To create a file into which your program will write, your program will contain a variable declaration
MyFile: Ada.Text_IO.File_Type;
To associate the file name with a file in the file system, include this statement after the BEGIN of your program:
Ada.Text_IO.Create (File=>MyFile,Mode=>Text_IO.Out_File,Name=>"calendar.dat");
To write an integer value into this file, use the file-oriented Ada.Text_IO operations, for example, if Today is an integer variable, use
Ada.Integer_Text_IO.Put(File=>MyFile,Item=>Today,Width=>2);