Answered step by step
Verified Expert Solution
Question
1 Approved Answer
What Day of Week is it Algorithm ( Using date 7 - 1 3 - 2 0 0 4 ) Take the last two digits
What Day of Week is it Algorithm Using date
Take the last two digits of the year and add a quarter onto itself. Example: is the year,
Hint: Use integer division to get the quarter.
A unique month code will be needed to compute the day of the week and should be stored in an array.
Create a onedimensional 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 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.
Assign the day number to a variable that will hold the day for it is
Add the numbers from steps and together NOTE: For leap years, subtract
only if the month is January or February.
Take away or multiples of until a number between is left. Hint: Use modulus.
The number you get from the above computations corresponds to the day of the week. Sunday,
Monday, Tuesday, etc. For the example of the value which implies Tuesday.
Algorithm to Find Days in a Month
January, March, May, July, August, October, and December all have days.
April, June, September, and November all have days.
February has days in nonleap years and in leap years.
Algorithm to Find Leap Year
Evenly divisible by noncentury years ie not evenly divisible by are leap.
Evenly divisible by century years that are also evenly divisible by are leap.
Requirements
Make sure to name your project with your last name, first name initial, and pgmX where is the program number. For
example, a student named Ben Afflack would use AfflackBpgm for his program solution.
Your solution MUST meet these additional requirements:
Use only ONE dowhile loop to validate the user's choice of console or file input. The user must
enter or only.
Use only ONE while loop to process dates either from console input or file input
Use ONE onedimensional array of integers to store the special code, as shown in the above table.
Use ONE switch statement to assign the dayofweek name based on the computed dayofweek
value eg "Sunday"
Use ONE ifelseif statement to assign the month name
Use ONE ifelseif statement to assign days for a month
Use modulus in your computation
Do not compute anything if the use selected file but the file is not found
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started