This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

DonaldDuck
DonaldDuck presents ...

2011/1/8

Birthday Calculator

So here is a random birthday calculator I made just for fun. It's done completely in the JOptionPane and isn't exactly correct. I think it's missing leap years or something. This was just practice for me using while loops and other java packages that could come in handy some day.

If your birthday isn't calculated correctly, or something goes terribly wrong, comment here, and I'll do my best to fix it.

3842 views / 15 in the last 7 days

Tags: demo with-source calculator birthday

open in greenfoot
Your browser is ignoring the <APPLET> tag.
HTML5 version not available | Scenario not running?
DonaldDuckDonaldDuck

2011/1/10

Ah, I'll fix that ASAP. Thanks spaceblue.
amooshiamooshi

2011/1/10

Nice. Gives an interesting result if you leave out the / between dates. Haha.
spacebluespaceblue

2011/1/10

I typed in a birthday - the console printed "today is 1/10/1210."
DonaldDuckDonaldDuck

2011/1/10

Yes, the console should output the day today, whether the day was parsed correctly (and if so, what the result of the parse was), the values of both your birthday and today's date, and your birthday. The 1210 I'm not entirely sure about...
A new version of this scenario was uploaded on Mon Jan 10 23:52:51 UTC 2011 Seems to be outputting the correct information now. Fixed it so the NullPointerException doesn't occur if you click cancel. Birthday's should be calculated near-perfect now.
A new version of this scenario was uploaded on Tue Jan 11 02:04:24 UTC 2011 Tells you what day (Monday through Sunday) you were born on.
A new version of this scenario was uploaded on Tue Jan 11 02:08:19 UTC 2011 Wishes you a happy birthday on the day before your birthday.
DonaldDuckDonaldDuck

2011/1/11

Something went wrong, it's parsing things weirdly...
mjrb4mjrb4

2011/1/11

Might be nicer if you changed it to work with Greenfoot actors rather than swing dialogs? There's a new constructor on GreenfootImage in 2.0.1 that should make this easy, and it saves dialogs popping up all over the place (sometimes they appear on a completely different monitor for me!)
DonaldDuckDonaldDuck

2011/1/11

Sounds good. I was originally planning on getting the birthday through the JOptionPane and then drawing the information onto the world canvas, but I got lazy. I'll change it to be all with Greenfoot Actors though. Thanks for the feedback

See all comments

Want to leave a comment? You must first log in.

Who likes this?

No votes yet.