Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to make a calender

 
Radhakrishna Sharma Gorenta
Ranch Hand
Posts: 63
Google App Engine Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How to make a calender in JAVA that can take a date format and then display the corresponding just like a normal calender date in graphical mode. the code shold not contain any predefined API. Please help me any one by just saying the algorithm. And the the design steps....
 
Madhan Sundararajan Devaki
Ranch Hand
Posts: 312
Java MS IE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't think you can achieve what you want, without using pre-defined API (for example, Swing...) as JAVA is made of pre-defined APIs. ;)
 
Greg Brannon
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The OP probably means that existing APIs that provide calendar and date functions can't be used.

Here's a rough outline of what must be done:

Hopefully, there's a reasonable bound to the problem; beginning and end dates for which your program must work. I'll assume so.

1. Get a date from the user (month/year).
2. Check that the date is valid: between the upper and lower bounds, a real month/year, etc.
3. Determine the starting day for the user's month and year.
a. Based on knowledge of one day within the bounded dates
b. Determine the leap years between known date and user date
c. Calculate the starting day of the user's month.
4. Determine the number of days in the user's month
5. Using result of 3 and 4, print the user's month/year.
a. Typical format:
Month/Year
S M T W T F S
(skip the number of days before the correct start date, then print the dates.)
5. Continue until the user is done.
 
Jim Hoglund
Ranch Hand
Posts: 525
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you want to do with the displayed date/calendar after it has been displayed?

Jim ... ...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic