Question: Design a C program for the following problem. This MUST be a C program. Program Overview: You are to design a C program that functions

Design a C program for the following problem. This MUST be a C program.

Program Overview:

You are to design a C program that functions as a calendar printing program. The user will input a year, month, and day in any given year. They will also input the day of the week. The program must then print out the calendar for the month the date falls on.

Program Requirements:

  1. The program should make use of arrays, functions, structures and pointers.
  2. Prompts the user to enter a year, month, and day for a date (For example: 2018, 7, 27 for July 27, 2018). This program should validate the values entered for the year, month and day. (Based on a leap year and the number of days in that month. i.e.: Program shouldNOTallow a user to enter February 30, -1999).
  3. Prompts the user to enter an integer representing the day of the week for this date (For example, 1 for Sunday, 2 for Monday and so on). This value should also be validated to ensure it is between 1 and 7. (i.e.: Program shouldNOTallow a user to enter -3, $, apple, etc.)
  4. Prompts the user to enter an integer value between 1 and 12 for the month for which a calendar is requested. The month should be in the year of the date inputted in 1. The entered value should also be validated like numbers 1 and 2.
  5. Generate and print the calendar for the month of the inputted date as shown below.
  6. ALL INPUTS MUST BE CHECKED FOR VALID USER INPUT. The program shouldNOTterminate, crash, infinitely loop, etc., if an incorrect input is entered such as a character, string, symbols, etc. If an incorrect input is entered, the program should prompt the user to enter a value again and again, until an acceptable value is entered.
  7. The program should also have comments explaining various parts of the code.

Example Output:

Welcome to the calendar printer!

Please enter a year as a 4-digit integer: 0

Incorrect year. Please try again.

Please enter a year as a 4-digit integer: -2018

Incorrect year. Please try again.

Please enter a year as a 4-digit integer: 2020

Please enter the month of that year as an integer: 13

Incorrect month. Please try again.

Please enter the month of that year as an integer: Apple

Incorrect month. Please try again.

Please enter the month of that year as an integer: 7

Please enter the day of that month as an integer: 32

Incorrect day. Please try again.

Please enter the day of that month as an integer: ~~~

Incorrect day. Please try again.

Please enter the day of that month as an integer: 21

To select a day of the week, enter one of the following integers:

1 for MONDAY 2 for TUESDAY 3 for WEDNESDAY

4 for THURSDAY 5 for FRIDAY 6 for SATURDAY 7 for SUNDAY

Please enter the day of the week: 9

Incorrect day of the week. Please try again.

Please enter the day of the week: *#2

Incorrect day of the week. Please try again.

Please enter the day of the week: 2

Calendar for July 21, 2020:

------------July 2020------------- Sun Mon Tue Wed Thu Fri Sat 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

See image below for better formatting:

Design a C program for the following problem. This MUST be a

- --July 2028---- Sun Mon Tue Wed Thu Fri Sat 1 3 4 5 6 7 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31

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 Programming Questions!