Question: Write a program dates.c that asks the user to enter a date in the form of an integer for a month, for a day and


Write a program dates.c that asks the user to enter a date in the form of an integer for a month, for a day and for a year. It then checks if the date is a valid one, i.e. if the month is one out of the numbers 1 through 12, if the year is between 1600 and 2400 and if the day is one of the possible days for that month (and that year). If the user enters an incorrect date, the program indicates that an error has occurred and it prompts the user again. It keeps on prompting until the user enters a correct date. See below for examples. Once the user has entered a correct date, the program outputs that date in both English and French, on two lines, one below the other. See below for examples. For English, the program first writes out the month in letters, such as February, then the day in numerical digits, then the letters st, nd, rd or th according to what is necessary to form the correct ordinal form in English, finally followed by the year in numerical digits. For French, the program first writes out the day in numerical digits, followed by the letters er for the first day of the month and nothing for all other days, followed by the month in letters (see below for a tables of French month names) and finally followed by the year in numerical digits. Boilerplate code is provided for this program but it is essentially empty. French Month Names: January janvier February fvrier March mars April avril May mai June juin July juillet August aot September septembre October octobre November novembre December dcembre Input/Output examples: Please enter a month (1-12): 2 Please enter a day (1-31): 17 Please enter a year (1600-2400): 2021 February 17th 2021 17 fvrier 2021 Please enter a month (1-12): 7 Please enter a day (1-31): 14 Please enter a year (1600-2400): 1789 July 14th 1789 14 juillet 1789 Please enter a month (1-12): 23 Please enter a day (1-31): 9 Please enter a year (1600-2400): 2000 The date you entered is invalid. Try again. Please enter a month (1-12): 9 Please enter a day (1-31): 23 Please enter a year (1600-2400): 2000 September 23rd 2000 23 septembre 2000 Please enter a month (1-12): 2 Please enter a day (1-31): 29 Please enter a year (1600-2400): 2000 February 29th 2000 29 fvrier 2000 Please enter a month (1-12): 2 Please enter a day (1-31): 29 Please enter a year (1600-2400): 1900 The date you entered is invalid. Try again. Please enter a month (1-12): 2 Please enter a day (1-31): 28 Please enter a year (1600-2400): 1900 February 28th 1900 28 fvrier 1900
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
