Those statements will give you the days for the month. There is no need to do a sum.
Create a method that returns the days for a month with those if statements.
The valid months are 0 to 11. ...
Type: Posts; User: Norm
Those statements will give you the days for the month. There is no need to do a sum.
Create a method that returns the days for a month with those if statements.
The valid months are 0 to 11. ...
How about a list of if statements that adds the days in month to a total depending on if selected month is greater than this month's id.
Can you use the accumulated number of days in the program? ...
Put the days/month in a 12 element array. If past Feb add 1 for leap year
Or have put accumulative days in array to save having to sum them.
Ok, so only for 2018 and Jan 2018 starts on Monday.
To get the DoW for Feb 1, use modulus 7 on the days in January and add that to Monday. Continue month by month to the desired month.
That doesn't answer my questions. Your user input does not have the year for month to display.
To be able to find the DoW that a selected month in a year starts on I think you need a base date to...
What is the program's input? For example Month and year?
What is a data point that anchors the calendar? A DoW for a given Month and year. For example: Nov 1978 starts on a Wednesday.
Are you asking what DoW the first day in a month in a given year starts on?
For example Nov 1978 starts on a Wednesday.
First work out the algorithm, then write the code based on that.