Question: Task The task is to read a file, which consists of one date on each line. Each date should be stored in a Date abject.

 Task The task is to read a file, which consists ofone date on each line. Each date should be stored in a

Task The task is to read a file, which consists of one date on each line. Each date should be stored in a Date abject. If the next date is later than the previous date, a DateRange object should be created from the two dates. All the Date and DateRange objects should be printed out. Input and Output Consider the following input June 17, 1997 July 23, 1997 September 28, 1980 September 31, 1980 Mar. 2, 1980 Apr. 2, 1980 May 3, 1980 Nov 25, 1989 Dec 25, 1989 Jan 3, 1973 Note that the months might be writen in different ways. Also, note that there is one invalid date. This data should result in the following output: Date: June 17, 1997 Date: July 23, 1997 DateRange: Date: June 17, 1997 - Date: July 23, 1997 Date: September 28, 1980 Invalid Date Date: March 2, 1980 Date: April 2, 1980 DateRange: Date: March 2, 1980 - Date: April 2, 1980 Date: May 3, 1980 DateRange: Date: April 2, 1980 Date: May 3, 1980 Date: November 25, 1989 DateRange: Date: May 3, 1980 Date: November 25, 1989 Date: December 25, 1989 DateRange: Date: November 25, 1989Date: December 25, 1989 Date: January 3, 1973 Each of these lines should be the result of print statements like: System.out.println(date); System.out.println(daterange) where date and daterange are Date and DateRange objects, respectively

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!