• Post Reply Bookmark Topic Watch Topic
  • New Topic

calendar project  RSS feed

 
ian Cheney
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello guys i have been working on this problem for a while and this is what i have
This program is a calendar that accepts a year back to 1582 and a month then it prints a calendar on the screen.

I need to have the date not start on sunday every month




 
Knute Snortum
Sheriff
Posts: 4287
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What I'd do is write a subroutine that will know how to determine the day of week from the month and year.   You know the date is the first, so plug that and the month and year into the routine to get the day of the week.  Then start your calendar from that day.
 
Campbell Ritchie
Marshal
Posts: 56592
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch
Don't prepend all those spaces to your month names. If you need to space the months out you can use String#format (or similar) and give a width to the field with the %s tag. Or you can write "     " + monthName.
I shall alter the line with those names on, because it is too long, and you can see how to do it.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!