home *** CD-ROM | disk | FTP | other *** search
- -- Chapter 12 - Program 1
- with Text_IO;
- use Text_IO;
-
- procedure CH12_2 is
-
- type MONTH_NAME is (JAN,FEB,MAR,APR,MAY,JUN,JUL,
- AUG,SEP,OCT,NOV,DEC);
-
- package Int_IO is new Text_IO.Integer_IO(INTEGER);
- use Int_IO;
- package Enum_IO is new Text_IO.Enumeration_IO(MONTH_NAME);
- use Enum_IO;
-
- type DATE is
- record
- Month : MONTH_NAME;
- Day : INTEGER range 1..31;
- Year : INTEGER range 1776..2010;
- end record;
-
- Independence_Day : DATE;
- Birth_Day : DATE;
- Today,Pay_Day : DATE := (MAY,25,1982);
-
- begin
- Independence_Day.Month := JUL;
- Independence_Day.Day := 4;
- Independence_Day.Year := 1776;
-
- Birth_Day := Independence_Day;
-
- Pay_Day.Day := 30;
-
- Put("Independence day was on ");
- Put(Independence_Day.Month,2);
- Put(Independence_Day.Day,2);
- Put(",");
- Put(Independence_Day.Year,5);
- New_Line;
-
- Birth_Day := (Day => 19, Month => FEB, Year => 1937);
- Today := (JUL,14,1952);
- Pay_Day := (JUL, Year => 1954, Day => 17);
-
- end CH12_2;
-
-
-
-
- -- Result of execution
-
- -- Independence day was on JUL 4, 1776
-
-