// WeddingdatesOriginal.java (c) 2005 Kari Laitinen // http://www.naturalprogramming.com // 2004-10-06 File created. // 2005-07-25 Last modification. // This is the original version of the Weddingdates.java program. // During compilation the files Date.java, DateDistance.java, // and CurrentDate.java must be in the same folder // (directory) as this file. // Compile in MS-DOS window: javac Weddingdates.java // Execute in MS-DOS window: java Weddingdates class WeddingdatesOriginal { public static void main( String[] not_in_use ) { CurrentDate date_to_increment = new CurrentDate() ; int number_of_dates_printed = 0 ; System.out.print( "\n These are easy-to-remember dates for weddings and" + "\n other important events because the days and months" + "\n consist of the digits used in the year: \n" ) ; while ( number_of_dates_printed < 60 ) { String day_as_string = String.format( "%02d", date_to_increment.day() ) ; String month_as_string = String.format( "%02d", date_to_increment.month() ) ; String year_as_string = "" + date_to_increment.year() ; if ( year_as_string.indexOf( day_as_string.charAt( 0 ) ) != -1 && year_as_string.indexOf( day_as_string.charAt( 1 ) ) != -1 && year_as_string.indexOf( month_as_string.charAt( 0 ) ) != -1 && year_as_string.indexOf( month_as_string.charAt( 1 ) ) != -1 ) { // Now we have found a date that meets our requirements. if ( number_of_dates_printed % 5 == 0 ) { System.out.print( "\n" ) ; } System.out.print( " " + date_to_increment ) ; number_of_dates_printed ++ ; } date_to_increment.increment() ; } } }