// NewYearDaySundays.java Copyright (c) 2006 Kari Laitinen // http://www.naturalprogramming.com // 2006-02-15 File created. // 2006-02-15 Last modification. // When this program is compiled, Date.java and DateDistance.java // must be in the same folder (directory) together with this file. // Solution to exercise 11-3. class NewYearDaySundays { public static void main( String[] not_in_use ) { int future_year = 2007 ; int number_of_dates_printed = 0 ; while ( number_of_dates_printed < 5 ) { Date future_new_year_day = new Date( 1, 1, future_year ) ; if ( future_new_year_day.index_for_day_of_week() == 6 ) { System.out.print( "\n The day " + future_new_year_day + " is " + future_new_year_day.get_day_of_week()); number_of_dates_printed ++ ; } future_year ++ ; } } }