Computer Science Canada

The Calendar Program

Author:  GhettoSingh [ Mon Jun 09, 2003 8:21 pm ]
Post subject:  The Calendar Program

Hey everyone,
i'm new here and need some help with this turing program i have been assigned. I have to create a calander for all the months. The user will input the month, the first day of the month and how many days are in that month. The only problem i have is how should i even start this?
Does anyone have any ideas on what i can do.

Thank You all

Author:  nate [ Mon Jun 09, 2003 8:25 pm ]
Post subject:  If and else

Its basically just a bunch of ifs and else's.
var month :string
if month = "December" or month ="12" then
put "There are 31 days in ", month
elsif month ="November" or month ="11" then
put "There are 30 days in ", month
end if

I didn't complete the program but i am sure u get my point!

Author:  GhettoSingh [ Mon Jun 09, 2003 8:26 pm ]
Post subject: 

yeah but it has to display the calander. like a grid or somethin im' not to sure how though

Author:  GhettoSingh [ Mon Jun 09, 2003 8:31 pm ]
Post subject: 

like maybe i was thinking of making one grid and everytime the user enter's a month the title of the grid and the number of days changes. Could anyone help me in doing that? Like just start me off kind of

Author:  GhettoSingh [ Mon Jun 09, 2003 8:48 pm ]
Post subject: 

how come i habe this feelin no one gonna help me lol

Author:  Mephi [ Mon Jun 09, 2003 8:52 pm ]
Post subject: 

make a grid as a picture and put it as your background...then just use Font.Draws to put in the numbers in the right spots...and counted loops

Author:  GhettoSingh [ Mon Jun 09, 2003 8:53 pm ]
Post subject: 

damn i know i know this too Ez of a program to even belong here
very hard for me though

Author:  JayLo [ Mon Jun 09, 2003 8:56 pm ]
Post subject: 

how come i feel like you're cheating.

Author:  GhettoSingh [ Mon Jun 09, 2003 8:57 pm ]
Post subject: 

okay i'm sorry for giving that impression
the admin if he wants can delete this post
sorry guys

Author:  PaddyLong [ Mon Jun 09, 2003 10:08 pm ]
Post subject: 

or if you wanna be "uber doober" (I heard a guy say that once...) you could do some research on the Doomsday Algorithm and just get the year and then make the calendar Very Happy

I made a program that uses the doomsday algorithm a while ago - it's attached, but unfortunately uncommented

but first, get it working with input information like you're supposed to Razz
I would say, draw a grid that is 7 columns by 6 rows and use that as your base... probably also have a 3d array that is 7 columns by 6 rows and fill it with the dates that match up with them (and like -1 or 0 or something for indexes that are not actually in the month) so like the array for June 2003 would be like
(1,1) := 1 %June first is a monday so the first day of the first week is the day 1
(1,2) := 2
(1,3) := 3
(1,4) := 4
(1,5) := 5
(1,6) := 6
(1,7) := 7

(2,1) := 8
(2,2) := 9
(2,3) := 10
(2,4) := 11
(2,5) := 12
(2,6) := 13
(2,7) := 14
....
(5,1) := 29
(5,2) := 30
(5,3) := 0
(5,4) := 0
(5,5) := 0
(5,6) := 0
(5,7) := 0

etc

to fill the array I would have something like the current day of the week and whenever it gets to 7, put it back to 1 and also something for the current week # and whenever you reset your day of the week to 1, add one to the week # ... and whenever the month ends, reset the week # to 1

then when you go to display it just use a Font.Draw or locatexy to output the numbers into your grid... you should put this into a double for loop so you'd have like
for q : 1..6
for w : 1..7
locatexy (w*sizeofyourboxes, q*sizeofyourboxes)
put monthcalendar (q,w)
end for
end for


I've probably posted too much of how to do this :/ hopefully you can understand what I'm talking about

Author:  Prince [ Tue Jun 10, 2003 10:05 am ]
Post subject: 

Shocked


: