WITH Ada.Text_IO;
WITH Ada.Integer_Text_IO;
WITH Calendar;
WITH DayWeek;
PROCEDURE DayTest IS
--------------------------------------------------------------------
--| simple program to demonstrate the DayWeek package.
--| prompts user (non-robustly) for a month, day, and year,
--| and calls DayWeek.DayOfWeek to find the day of the week.
--| Author: Michael Feldman, The George Washington University
--| Last modified September 30, 1996
--------------------------------------------------------------------
 
  TYPE Days IS (Monday, Tuesday, Wednesday, Thursday,
                Friday, Saturday, Sunday);
  -- the order of the days corresponds to the numerical codes returned by
  -- DayOfWeek: Monday = 0, Tuesday = 1, etc.
 
  PACKAGE Days_IO IS NEW Ada.Text_IO.Enumeration_IO(Enum => Days);
 
  Year:  Calendar.Year_Number;      -- input - year
  Month: Calendar.Month_Number;     -- input - month
  Day:   Calendar.Day_Number;       -- input - day
 
BEGIN -- DayTest
 
  -- prompt for user input of year, month, and day.
 
  Ada.Text_IO.Put (Item => "Enter only good values;");
  Ada.Text_IO.Put(Item => " no allowances for others have been made.");
  Ada.Text_IO.New_Line;
  Ada.Text_IO.Put (Item => "Enter the year (4 digits): ");
  Ada.Integer_Text_IO.Get (Item => Year);
 
  Ada.Text_IO.Put ("1 = January     2 = February  3 = March      4 = April");
  Ada.Text_IO.New_Line;
  Ada.Text_IO.Put ("5 = May         6 = June      7 = July       8 = August");
  Ada.Text_IO.New_Line;
  Ada.Text_IO.Put ("9 = September  10 = October  11 = November  12 = December");
  Ada.Text_IO.New_Line;
  Ada.Text_IO.Put ("Enter the month: ");
  Ada.Integer_Text_IO.Get (Item => Month);
 
  Ada.Text_IO.Put ("Enter the day: ");
  Ada.Integer_Text_IO.Get (Item => Day);
 
  -- find and display the day of the week
 
  Ada.Text_IO.Put(Item => "That date fell on a ");
  Days_IO.Put (Days'Val(
                 DayWeek.DayOfWeek(
                   Month => Month, Day => Day, Year => Year)));
  Ada.Text_IO.New_Line;
 
END DayTest;