Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The program must be written for Eclipse, as a Project created in a project as a class. Thanks in advanced. (: Files to be submitted

image text in transcribedThe program must be written for Eclipse, as a Project created in a project as a class. Thanks in advanced. (:

Files to be submitted An algorithm - a regular text file e Java Source code -a Java source file Supporting files if any Write a program to prompt the user for 2 dates consisting of a month and a year and display the number of years and months between these 2 dates. Either date could be the earlier date It is REQUIRED to use the following solution to calculate the difference between two dates that are not in the same ear: 1. To calculate a positive year difference and the corresponding month difference, Subtract the earlier year from the later year to get the year difference. Subtract the month associated with the earlier year from the month associated with the later year a. b. The month difference can be negative (see examples in the table below). No. Dates Real Date Difference These dates are 12 years and 5 months apart These dates are 2 years and 10 months apart These dates are 3 years and 0 months apart These dates are 0 years and 4 months apart These dates are 0 years and 0 months apart. Subtracting months and years 12 years and 5 months August, 2011 March, 1999 June, 1999 ril, 2002 July, 1998 July, 1995 March, 1995 2 years and -2 months 3 years and 0 months 0 year and 4 months 0 year and 0 month July, 1995 December, 1998 December, 1998 In sample 2, the month difference is negative. The difference, 3 years and -2 months, means it would be 3-year difference if this were 2 months later. A date difference should not contain a negative month difference. A negative can be adjusted by regrouping one year difference into 12 month difference 2. To calculate a date difference between two dates that are in the same year, the year difference is always zero. The month difference should be calculated as a non-negative value

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions