Text: Review the "Part-1 Output Example" (next section) to see how this program is expected to work. Code your program in the file named "w3p1.c". IMPORTANT: Do NOT use arrays in this workshop. Alter the system library #include, and before the main function, define two macros:
#define MIN_YEAR 2010
#define MAX_YEAR 2021
Inside the main function, declare two (2) unmodifiable integer variables "JAN" and "DEC" representing the first and last months of the year respectively (initialize "JAN" to 1 and "DEC" to 12).
Display the title for the well-being log application.
Nest inside an iteration construct the following:
a) Display the following message:
> Set the year and month for the well-being log (YYYY MM):
b) Read from standard input (keyboard) the year and month (entered on the same line with a space between) assigning the input values to two integer variables (having meaningful names representing the data they store).
Apply what you have learned about selection to define the necessary logic that will validate the values entered for the year and month.
- The entered year value must be between MIN_YEAR and MAX_YEAR inclusive.
- The entered month value must be between JAN and DEC inclusive.
If any of the above validations fail, the respective error message(s) should be displayed (see example output to see what each error message should display).
Step #6 should continue to iterate until a valid year and month value is entered.
When a valid year and month is entered, display a message indicating the log starting date has been successfully set:
Log date set!
Display the log start date in the format: YYYY-MMM-DD
- YYYY: The year as 4-digits
- MMM: First 3-characters of the month name
- DD: The 2-digit day