Using the Day class of Worked Example 2.1, write a program that generates a Day object representing February 28 of this year, and three more such objects that

profileadelen
 (Not rated)
 (Not rated)
Chat

 

Using the Day class of Worked  Example 2.1, write a program that generates a Day object representing  February 28 of this year, and three more such objects that represent  February 28 of the next three years. Advance each object by one day, and  print each object. Also print the expected values

Example 2.1: 

public class DaysAlivePrinter

{

 public static void main(String[] args)

 {

  Day jamesGoslingBirthday = new Day(1955, 5, 9);

  Day today = new Day();

  System.out.print("Today:");

  System.out.println(today.toString());

  int daysAlive = today.daysFrom(jamesGoslingBirthday);

  System.out.print("Day alive: ");

  System.out.println(daysAlive);

  }

 }

    • 5 years ago
    java code
    NOT RATED

    Purchase the answer to view it

    blurred-text