Age Calculator Demo in Java v1.0

Submitted By: bharathh
Rating: starstarstarhalf star (Rate It)
Share: Share By Email By Email

A simple program that calculates in years, months, and, days the number of days that a person has lived for since his/her date of birth.

Most age calculators that I found online were all wrong so I thought I'd create one of my own. It has an agecalculator object that can basically calculate the age difference between any two dates with a little modification. Currently the upperbound date is set to the date that the program is run on.

I've tried to write REALLY clean code, but please do send in your comments and feedback on what you think about it.

README is included in the source.


NOTE: Some downloads must be obtained through publishers´s site.
Do you want to get your software listed on this site? Go to our submissions area.

Screenshot


Details

File Name:
52890.zip
Product homepage:
Order page:
Languages:
Unknown
Platforms:
Unknown
Release date:
5/3/2007
License:
Unknown
Size:
58 KB
Price/Fee (US$):
Unknown
Number of downloads:
1497

Comments (4)

visit starstarstar   Posted by: bhavesh on Wednesday, January 28, 2009

its nice!!!!!!!!!!!!11

Very useful starstarstarstarstar   Posted by: rv.kalpana on Sunday, February 15, 2009

Hi ur right.. there is no perfect age calculator in java on net.. after exhaustive search i found urs...its very useful.. thank u..

this code is wrong starstar   Posted by: proj manager on Friday, April 24, 2009

to correct:
in file AgeCalculator.java line 201 should be

dayToday += dayBorn;

best regards

Please find my agecalculator(normal) starstarstarstar   Posted by: Suren on Thursday, August 09, 2012

import java.io.*;
class AgeCalculator{
public static void main(String args[])
{
InputStreamReader ins=new InputStreamReader(System.in);
BufferedReader hey=new BufferedReader(ins);
try{
System.out.println("Please enter your name: ");
String name=hey.readLine();

System.out.println("Please enter your birth date: ");
String date=hey.readLine();

System.out.println("please enter your birth month:");
String month=hey.readLine();

System.out.println("please enter your birth year:");
String year=hey.readLine();

System.out.println("please enter current year:");
String cYear=hey.readLine();

int bDate = Integer.parseInt(date);
int bMonth = Integer.parseInt(month);
int bYear = Integer.parseInt(year);
int ccYear=Integer.parseInt(cYear);

int age;
age=ccYear-bYear;

int totalMonth=12;
int yourMonth=totalMonth-bMonth;

System.out.println(" Hi " + name + " your are " + age + " years " + yourMonth + " months old ");

}
catch(IOException err)
{
System.out.println("");
}
}
}

Add Your Rating

(Not published)
star
starstar
starstarstar
starstarstarstar
starstarstarstarstar
 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.