
This project depends upon Chapters 1-5, and provides experience with writing loops and using files.
In this project you will employ the DayWeek package from lab #6 (not in the book, but it's in the program directory) to create a disk file called my_calendar.dat. Your program will prompt the user for a starting date and an ending date, then write, into the external file, a line for each day in the given range. For example, if the user enters
APR 2 1993 MAY 29 1993
as the starting and ending months, the file will contain, after the program is done, 58 lines. The first line will say
FRI APR 1 1993
and the last line will say
WED MAY 29 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=>Ada.Text_IO.Out_File,Name=>"my_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);