Question: Do this program with only using very basic console input / output , variables, constants, assignments, branches, loops, file I / O , and arrays

Do this program with only using very basic console input/output, variables, constants, assignments, branches, loops, file I/O, and arrays concepts. Make everything within the int main(){} function. DO NOT MAKE SEPERATE FUNCTIONS. Create a C++ program to read dates from the console or data file. The dates have to be between January 1,
2000, and December 31,2099.
For each date, determine what day of the week this date falls on. If the date falls outside the valid range,
do not process it. Output an appropriate error message: For example, for 12-13-1998, the message should
be "ERROR: 12-13-1998 is outside of range".
You may assume that the day-month will be integers greater than 0 and that the combination will be valid,
i.e., there will not be a month >12 or day >31 or any invalid combination of the two. Months and days
will have a leading 0 if needed.
Ask the user if they wish to input dates via the console window or process dates out of a data file. If the
user selects the console, allow them to enter any number of dates until they enter DONE.
How do you want to provide the data? [C-onsole, or F-ile]: C
Enter date [mm-dd-yyyy, or DONE]: _
If they select a data file, process the supplied data file named Pgm5_Data.txt until all dates are processed.
There will not be DONE at the end of the file. Create an output file called Pgm5_Output.txt containing all
processed dates and appropriate error messages for dates falling outside the required range. Assume dates
in range will be in proper date format, i.e., mm-dd-yyyy where m=month, d=day, and y=year digits.
If the provided date is 07-13-2004, then the program's output should be:
July 13,2004, falls on a Tuesday (31 days)
If the provided date is 02-29-2024, then the program's output should be:
February 29,2024, falls on a Thursday (29 days)
Note that your program must determine if a given year is a leap year to determine the number of days in
the date's month. You will also use a specific algorithm to find the day of the week, given a date in the
described format.
2
What Day of Week is it Algorithm (Using date 7-13-2004)
1. Take the last two digits of the year and add a quarter onto itself. (Example: 2004 is the year, 04+1=5)
Hint: Use integer division to get the quarter.
2. A unique month code will be needed to compute the day of the week and should be stored in an array.
Create a one-dimensional array to hold the month codes, as shown in the below table.
Assign the month code based on the month of your date. Note: if the month is July, the month code used for
computation will be 5(see the arrow in the table above). The code is not the month's number. Use the table
to find the month code needed for a particular month in your date.
3. Assign the day number to a variable that will hold the day (for 7-13-2004, it is 13).
4. Add the numbers from steps 1,2, and 3 together (5+5+13=23). NOTE: For leap years, subtract 1
only if the month is January or February.
5. Take away 7(or multiples of 7) until a number between 0-6 is left. (23-21=2) Hint: Use modulus.
The number you get from the above computations corresponds to the day of the week. (0=Sunday, 1=
Monday, 2= Tuesday, etc.). For the example of 7-13-2004, the value 2, which implies Tuesday.
Algorithm to Find Days in a Month
1. January, March, May, July, August, October, and December all have 31 days.
2. April, June, September, and November all have 30 days.
3. February has 28 days in non-leap years and 29 in leap years.
Algorithm to Find Leap Year
1. Evenly divisible by 4 non-century years (i.e., not evenly divisible by 100) are leap.
2. Evenly divisible by 4 century years that are also evenly divisible by 400 are leap.
Requirements
Make sure to name your project with your last name, first name initial, and "_pgmX" where X is the program number. For
example, a student named Ben Afflack would use AfflackB_pgm1 for his program 1 solution.
Your solution MUST meet these additional requirements:
1. Use only ONE do-while loop to validate the user's choice of console or file input. The user must
enter C or F only.
2. Use only ONE while loop to process dates (either from console input or file input).
3. Use ONE one-dimensional array of integers to store the special code, as shown in the above table.
4. Use ONE switch statement to assign the day-of-week name based on the computed day-of-week
value (e.g.,0=> "Sunday")
5. Use ONE if/else-if statement to assign the month name
6. Use ONE if/else-if statement to assign days for a month
7. Use modulus in your computation
8. Do not compute anything if the use selected file but the file is not foundJan Feb Mar Apr. May Jun Jul Ago Sept Oct Nov Dec
622503514624
3
9. Open and close files only if the user selects file input and the files were opened
10. None of the implementations in requirements 1 through 6 can be used more than once ( you cannot compute leap year more than once, you cannot have two if/else-if statements assigning month name)

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!