We continue working with Gregorian dates for this assignment. Your program will prompt the user to enter a date and a non-negative integer, N. You are to find the date in the calendar N days from the given date.
Your program should continuously prompt the user to enter a date in the form yyyy-mm-dd. year is an integer greater than 1752, month is an integer in the range 112, and day is an integer in the range 131. N is a non- negative integer in the range 0 < N < 10000. Your program will continue to prompt the user to enter a date and the number of days in the future until the user enters 0-0-0.
Handle input failure gracefully. If the user enters invalid data, display a meaningful message, then continue normal processing. Failed inputs do not count toward the total number of cases.
You can use the Linux date command to validate your programs output. For example, the date 90 days after 2017-01-01 can be found by:
$ date -d '2017-01-01 +90 days' '+%Y-%m-%d'
2017-04-01
For each input, output the case number followed by the date after N days in the same format as the input. Look at the sample below for exact format:
$ ./pa05
Enter a date in the form yyyy-mm-dd (0-0-0 to quit): 1776-07-04
Enter the number of days to add: 365
Case 1: 1777-07-04
Enter a date in the form yyyy-mm-dd (0-0-0 to quit): 2017-01-01
Enter the number of days to add: 90
Case 2: 2017-04-01
Enter a date in the form yyyy-mm-dd (0-0-0 to quit): 0-0-0
$