University
of Delaware


Year 2000 Examples

Example 1: Fortran Program samp1.f - 2-digit Year Processing


	character*6 date1,date2
        character *20 name1,name2
        common name1,name2,m1,m2,d1,d2,y1,y2
	integer m1,m2,d1,d2,y1,y2
        read(*,'(a)')name1
	read (*,'(a)')date1 
        read(*,'(a)')name2
	read (*,'(a)')date2 
	read(date1,'(3i2)')m1,d1,y1
        read(date2,'(3i2)')m2,d2,y2
        if(y1.eq.y2.and.m1.eq.m2.and.d1.eq.d2)then
         print *, name1,' with birthdate: ',m1,'/',d1,'/',y1
	 print *
	 print *, 'is the same age as'
	 print *
	 print *, name2,' with birthdate: ',m2,'/',d2,'/',y2 
        else if(y1.eq.y2.and.m1.eq.m2)then
          call compare(d1,d2)
        else if(y1.eq.y2) then
          call compare(m1,m2)
        else
	  call compare(y1,y2)
        endif
	end
	subroutine compare(ix1,ix2)
	character *20 name1,name2
	integer  m1,m2,d1,d2,y1,y2
        common name1,name2,m1,m2,d1,d2,y1,y2
	if(ix1.gt.ix2) then 
	  print *, name1,' with birthdate: ',m1,'/',d1,'/',y1 
	  print *
	  print *, 'is younger than'
	  print *
	  print *, name2,' with birthdate: ',m2,'/',d2,'/',y2
	else
	  print *, name2,' with birthdate: ',m2,'/',d2,'/',y2
	  print *
	  print *, 'is younger than'
	  print *
	  print *, name1,' with birthdate: ',m1,'/',d1,'/',y1 
	endif
	end

Enter two sets of names and birthdates using 2-digit years

Examples:


     The following example will give the correct answer:

        John Brown
        010180
        Fred Smith
        010190

     The following example will give the wrong answer:
        Tom Younger
	010100
	Tom Older
	010199 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to progam samp1.f


Example 2: Fortran Program samp1fixedw.f - 2-digit Year Processing Using a Fixed Window with Pivot Year 1960

We modify the program, samp1.f, to include fixed window logic, producing samp1fixedw.f

Enter two sets of names and birthdates using 2-digit years

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= 60 designate 1900 + the
year and 2-digit years < 60 designate 2000 + the year.
The fixed window covers the years 1960 to 
2059 inclusive. 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 3: Fortran Program samp1slidew.f - 2-digit Year Processing Using a Sliding Window

This section for a sliding window is not operational. Work in progress.

We modify the program, samp1.f, to include sliding window logic, producing samp1slidew.f

Enter two sets of names and birthdates using 2-digit years

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= pivot



 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 4: Fortran Program samp1compress.f - 2-digit Year Processing Using a Hexidecimal Representation

This section that uses compression is not operational. Work in progress.

We modify the program, samp1.f, to include sliding window logic, producing samp1compress.f

Enter two sets of names and birthdates using 2-digit years

Examples:



     The following examples give the correct answers 
assuming that 2-digit years >= pivot



 

        Sally Smith
        010159
        Fred Smith
        010160

        Tom Younger
	010140
	Tom Older
	010124 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to program samp1expand.f


Example 5: Fortran Program samp1expand.f - 4-digit Year Processing

We modify the program, samp1.f, using 4 digit year variables in place of 2-digit years producing samp1expand.f

Enter two sets of names and birthdates using 4-digit years

Examples:


        John Brown
        01011980
        Fred Smith
        01011990

        Tom Younger
	01012000
	Tom Older
	01011999 

   Name 1:   
   Age 1 :   

   Name 2:   
   Age 2 :   
Submit the age/birthdate data to proram samp1expand.f


Example 6: Fortran Program samp2.f - 2-digit Year Processing with Input from a File

We modify program samp1.f to produce the program samp2.f . Program samp2.f reads input from file file samp2in which contains the lines:

Bob Barker
011077
Tom Tyler
102088

Submit the age/birthdate data to progam samp2.f


Example 7: Fortran Program samp2expand.f (input from a file)

This program is in process

Submit the date and time to the getdate routine