02-01-2005, 07:14 PM
Hi.
Yesterday, my class was given the assignment to make a calendar in Qbasic. The goal of the calendar is for the user to input a date (month, day, year) and then the program prints out the month containing that date. It can be any day of any month, of any year.
The only problem is... I have no idea what to do. I'm not very good in programming (I'm a B- student) so I'm kind of stuck whereas others are being successful.
Anyways, we were given this equation to help us find any date in history:
N = D + 2*M + INT(3*(M+1)/5 + Y + INT(Y/4) - INT(Y/100) + INT(Y/400)+2
Obviously d is the day, m is the month, and y is the year.
We were also told that when we found N, we should mod it by 7, and the result would the day of the week. For example, if N mod 7=0, then the day would be Saturday. If N mod 7=1, then the day would be Sunday. 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday
And for months, January and Feburary use 13, 14 (respectively) for the month number, plus they use the previous year. For example, if the input is 2,13, 2001 (Feb, 13th, 2001) then the program would need to use 14, 13, 2000.
The program prints out the calendar in question, and then allows the user to go again.
As you can guess, I'm extremely confused and have no idea where to start. I don't expect anyone to do the project for me, but I'd greatly appreciate it if somebody could give me a push in the right direction.
Thank you.
EDIT- I neglected to mention that I can design the calendar just fine. It's the whole science behind the dates and whatnot that's got me completely confused. Thanks again.
Yesterday, my class was given the assignment to make a calendar in Qbasic. The goal of the calendar is for the user to input a date (month, day, year) and then the program prints out the month containing that date. It can be any day of any month, of any year.
The only problem is... I have no idea what to do. I'm not very good in programming (I'm a B- student) so I'm kind of stuck whereas others are being successful.
Anyways, we were given this equation to help us find any date in history:
N = D + 2*M + INT(3*(M+1)/5 + Y + INT(Y/4) - INT(Y/100) + INT(Y/400)+2
Obviously d is the day, m is the month, and y is the year.
We were also told that when we found N, we should mod it by 7, and the result would the day of the week. For example, if N mod 7=0, then the day would be Saturday. If N mod 7=1, then the day would be Sunday. 2=Monday, 3=Tuesday, 4=Wednesday, 5=Thursday, 6=Friday
And for months, January and Feburary use 13, 14 (respectively) for the month number, plus they use the previous year. For example, if the input is 2,13, 2001 (Feb, 13th, 2001) then the program would need to use 14, 13, 2000.
The program prints out the calendar in question, and then allows the user to go again.
As you can guess, I'm extremely confused and have no idea where to start. I don't expect anyone to do the project for me, but I'd greatly appreciate it if somebody could give me a push in the right direction.
Thank you.
EDIT- I neglected to mention that I can design the calendar just fine. It's the whole science behind the dates and whatnot that's got me completely confused. Thanks again.