CMPS 134 Fall 2023
Prog. Assg. #5: Date Difference
Due: 11:59pm, Monday, November 6

Specification

For this assignment you are to complete each of the stubbed methods in the Java application DateDifference so that they behave as specified. Having done so, the program will behave as illustrated below.

In the sample execution, the program is invoked from the command line, with the name of the input file (here, Dates.txt) being provided via a command line argument. When running the program from within the jGrasp environment, you would provide the file's name via a run argument. To clarify, the program reads input from a file, not from the keyboard.

$ java DateDifference Dates.txt
DateDifference...
10/05/2023 to 10/30/2023 is 25 days!
9/14/2023 to 10/19/2023 is 35 days!
8/23/2023 to 10/12/2023 is 50 days!
7/15/2022 to 7/20/2023 is 370 days!
9/1/2022 to 6/14/2023 is 286 days!
11/25/1998 to 12/1/2020 is 8042 days!
06/21/1955 to 12/01/2023 is 25000 days!
07/01/1890 to 05/14/1911 is 7621 days!
Done!!!
10/05/2023 10/30/2023
9/14/2023  10/19/2023
8/23/2023  10/12/2023
7/15/2022  7/20/2023
9/1/2022   6/14/2023
11/25/1998 12/1/2020
06/21/1955 12/01/2023
07/01/1890 05/14/1911
Sample Program Execution Dates.txt data file

As should be obvious, the program (repeatedly) determines the difference —measured in number of days— between two calendar dates. Each line of the input file is expected to contain the descriptions of two calendar dates in M/D/Y format, the first date being no later in time than the second.

For testing purposes, you may find the website at https://www.timeanddate.com/date/durationresult.html to be useful, as it appears to provide correct and reliable results for this task.

To produce accurate results, one needs to take account of the fact that leap years have 366 days and non-leap years only 365. The rule for determining this property is that a year is a leap year if (and only if) either

Thus, for example, 1900 was not a leap year.

Program Submission

Submit your program (necessarily named DateDifference.java) to the appropriate Brightspace dropbox. Be sure to complete the "header" comments to identify yourself, any people with whom you collaborated, and any flaws that you know to exist.