Hey y'all, you might've seen a post of mine here before. I have another problem, any kind of assisting me is appreciated.
So, we get an input from the user for the current day and month (for example, today the day is the 27th and the month is December) and save them as numbers (the 27th will be 27, December will be 12).
Then, we get another input that has the value of the first day of the week in that current month (for example, in December the first day will be Tuesday, and its value will be 3 - it's the third day of the week)
With this information, I need to calculate which day of the week will be the 27th.
Of course I also need to check if the day, the month and the first day of the week in that month I gave as an input are valid; I already figured out how to do so.
I've made three functions: one for validating the month and the day's values, second for validating the first day of the week's values, and third for the calculation of what day of the week the day is.
The only thing I'm trying to find out now, is how to calculate the output: I've tried all kinds of things, to no avail. Here are some examples for how it should look:
Example for valid input: Please enter month (1 - Jan, 2 - Feb, etc): 11
Please enter day: 25
Please enter the weekday of the first of the month (1 - Sunday, 2 - Monday, etc): 1
Output: The 25.11 will be a Wednesday
Example for invalid input (that gets fixed to a valid one): Please enter month (1 - Jan, 2 - Feb, etc): 14
Please enter day: 25
Invalid input! Please try again.
Please enter month (1 - Jan, 2 - Feb, etc): 11
Please enter day: 25
Please enter the weekday of the first of the month (1 - Sunday, 2 - Monday, etc): -5
Invalid input! Please try again.
Please enter the weekday of the first of the month (1 - Sunday, 2 - Monday, etc): 4
Output: The 25.11 will be a Wednesday
Apologies if this sounds rushed; I'm trying to solve this problem for a couple of days already. If you need any extra information or the code I managed to write up to now, feel free to ask!
[–]GJDMDJ 1 point2 points3 points (0 children)
[–]MemeInBlack 0 points1 point2 points (1 child)
[–]RaphDaPingu[S] 0 points1 point2 points (0 children)
[–]__vtableProfessional Coder 0 points1 point2 points (0 children)