• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calender class and its components  RSS feed

 
Nickesha Lindsay
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there. This is the first time ever that I'm using the Calender class. First, let me describe exactly what I want to do before I ask any further questions:
1.) I would like to create a calender with all 12 months.
2.) I would like user input that asks for a date (number), and then shows the month, the date and the day of the week for the date selected.

For example:
Enter date: 11/11/03
or
Enter month:
Enter day:
NOVEMBER 2003
-----------------------------------------------
Sun Mon Tue Wed Thurs Fri Sat
1
2 3 4 5 6 7 8
9 10 [11] 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
----------------------------------------------
Day of Week: The date you selected was on a Tuesday
-----------------------------------------------------------

3.) The date selected has to be highlighted in some way or form, as shown above on the 11....

Now with that in mind, which classes or methods do I use to declare the months? I have an idea but I'm still very unsure and how to implement them in my program.
How do I go about getting the user input and tying that in with indicating the month, date and day on the calender, like the one above?
Should I use an applet or GUI to get the best results?
Is there any other classes/methods I need to be aware of to make this work?
I would REALLY appreciate examples or links to help out on this project of mine. Thanks alot!!!...
 
James Swan
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
ok this snippet shows you the basic methods you need to use on the Calendar class

it's output:

Obviously you will need to determine the "best" way to present your results, also how to handle accepting a particular date as opposed to the current date, but should give you enough to wail away on.
 
Nickesha Lindsay
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Question:
Besides getting the current date and printing out its corresponding month, year, and days,I wanted to get user input to calculate ANY year and print a caleder with the month, days, and year, and tell whether the year entered is a LEAP year.
To get the input started, I use a Keyboard class, right?
To get the leap year ,I use module arithmetic such as 200%4 -> if the remainder is zero, then its a leap year. Correct?
Then what? Should I seperate the user inputs to ask for a year, month, then day?
How do I do this and print it out neat calendar for any year,month, and day the user inputs???
Can you list the Calendar classes (code preferably) I should use to get this all working?
Sorry about the 21 questions rant, but I need this pronto.
Thanks alot....
P.S. I don't want it to necessarily be an applet or GUI program. Just plain old algorithms, variables,boolean logic, and all the proper and necessary Calendar classes needed will do...
 
Nickesha Lindsay
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh by the way, can any of you suggest any sites or links that may be helpful in explaining the usage of these Calendar methods and classes and when and how to use them?
So far during my research on the net, this topic is pretty vage. The only examples of Java calendars I have seen has been highly graphical with no explanations as to how they calculated the years, months, why they use the classes or anything.
Some sites name all the Calendar classes, but fail to explain how they are used, what they contain, and when to use them.
I know there are specific formulas as to how to calculate the leap year and such, but don't the Calendar methods have this? That's why I want to know...

Please, any info on Calendar classes, methods, programs and coding would be extremely helpful at this point.
Thank you....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!