Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Month input must be a string Files to be submitted: * An algorithm - a regular text file Java Source code -a Java source file

Month input must be a stringimage text in transcribed

Files to be submitted: * An algorithm - a regular text file 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 year: 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 vears and 5 months apart. These dates are 2 vears 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 August, 2011 March, 1999 June, 1999 ril, 2002 July, 1998 July, 1995 March, 1995 July, 1995 December, 1998 December, 1998 12 years and 5 months 3 vears and-2 months 3 vears and 0 months 2 0 year and 4 months 0 year and 0 month 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

Database Processing

Authors: David M. Kroenke, David Auer

11th Edition

B003Y7CIBU, 978-0132302678

More Books

Students also viewed these Databases questions

Question

=+ (c) Show that f is a measure on Fand agrees with a on Fo.

Answered: 1 week ago

Question

Does it have correct contact information?

Answered: 1 week ago