Question: Modify the CalendarDate class from this chapter to include a year field, and modify its compareTo method to take years into account when making comparisons.

Modify the CalendarDate class from this chapter to include a year field, and modify its compareTo method to take years into account when making comparisons. Years take precedence over months, which take precedence over days. For example, July 18, 1995, comes beforeMarch 2, 2001.

Step by Step Solution

3.19 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public class CalendarDate implements Comparable private int year private i... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Building Java Programs A Back to Basics Approach Questions!