// DateDistance.java (c) 2005 Kari Laitinen // http://www.naturalprogramming.com // 2005-07-25 File created. // 2005-07-25 Last modification. /* This file contains the definition of class DateDistance, which is needed sometimes when class Date is used. To compile Date.java, you need to have this file in the same folder. A DateDistance object can store the chronological distance between two Date objects. Method get_distance_to() of class Date returns distance information to its caller inside a DateDistance object. */ class DateDistance { public int years ; public int months ; public int days ; } /* The DateDistance class could alternatively be introduced as a static inner class inside the Date class. (Inner classes are classes that are introduced inside other classes. They are not discussed in the book.) The class could be declared in the following way after the toString() method, and before the last closing brace } of the Date class: public static class Distance { public int years ; public int months ; public int days ; } After this modification the beginning of method get_distance_to() of class Date should be modified to look like the following public Date.Distance get_distance_to( Date another_date ) { Date.Distance distance_to_return = new Date.Distance() ; Then programs that use the get_distance_to() method should be modified so that Date.Distance would be written in place of DateDistance. For example, in Columbus.java should have the following statement: Date.Distance distance_between = date_of_discovery_of_america.get_distance_to( date_of_first_moon_landing ) ; ******/