Question: Write a method called monthApart that accepts four integer parameters, m1, d1, m2, and d2, representing two calendar dates. Each date consists of a month

Write a method called monthApart that accepts four integer parameters, m1, d1, m2, and d2, representing two calendar dates. Each date consists of a month (1 through 12) and a day (1 through the number of days in that month [28–31]). Assume that all parameter values passed are valid. The method should return true if the dates are at least a month apart and false otherwise. For example, the call of monthApart(4, 15, 5, 22) would return true while the call of monthApart(9, 19, 10, 17) would return false . Assume that all the dates in this problem occur during the same year. Note that the first date could come before or after the second date.

Step by Step Solution

3.42 Rating (152 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

public static boolean monthApart int mi int d1 int m2 int d... 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!