Question: Write a method named monthApart that accepts four integer parameters representing two calendar dates. Each date consists of a month (1 through 12) and a

 Write a method named monthApart that accepts four integer parameters representing

Write a method named monthApart that accepts four integer parameters 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 dates occur during the same year. The method returns whether the dates are at least one month apart. Note that the first date could come before or after (or be the same as) the second date. You must check that all parameter values passed are valid. For example, if you call monthApart(6, 14, 9, 21), it should return true, beacuse June 14 is at least a month before September 21. Sample calls: method call --> return value monthApart(4, 5, 5, 15); --> true monthApart(4, 15, 5, 15); --> true monthApart(4, 16, 5, 15); --> false monthApart(6, 14, 6, 8); --> false monthApart(10, 14, 7, 15); --> true

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Databases Questions!