I have been writing some toy programs to relearn my Java skills. This time around I decided to write a calendar app. Nothing fancy mind you. I just put out a text calendar to the console.
Initially I had visions of computing all kinds of dates. I thought I could start with a known day falling on a certain day of the week. Then I could compute all relative dates with some formulas. Sure I would have to deal with leap years and such. But that would be a great project.
I found that the Calendar class in java.util was almost all I needed. No need to compute the day of the week the first day of the month falls on. I just set up a Calendar object with that date. Then I interrogate it to figure out which day of the week it is. Same thing with determining the number of days in a month.
This exercise was quite useful. I got some practice. I also learned some details of a new class. Calendar feels like a nice API. You just have to learn some of its constants. Then you can get() or set() to your heart's content. I banged out my calendar app in about 50 lines of code. Given that I am a bit wordy with my code, that is not too shabby.
Free Laundry
-
Apparently a lot of apartment buildings have coin operated laundry machines
in the basement. And guess what? You can order a key to unlock the payment
me...
5 years ago