Saturday, 23 July 2016

public class DaysAlivePrinter
{
    public static void main(String[] args)
    {
        // Sally Ride was born on May 26 1951
        Day birthday = new Day (1951 , 5 , 26);
       
        // Her last day was July 23 2012
        Day Lastday = new Day (2012 , 7 , 23);
        // Use Day objects to calculate and print
        int DaysAlive = Lastday.daysFrom(birthday);
        // how many days she lived.
        System.out.println(DaysAlive);
        // You'll want to use the daysFrom method.
        // Do you expect to get a negative or a positive number of days?
    }
}

No comments:

Post a Comment