I need help on age calculation java programme
I'm a new member in this sites . I study in college and this is my first time in
studing Object Oriented Programming (Java) . I really need help to find the java code of this programme as soon as possible.
The question is:
*By using calnder class Write a program in java to calculate the age in days for the given date of birth.
If any one has an idea about it tell me please and thank you all.
Re: I need help on age calculation java programme
What you can do is to first make use of the system.Calendar class. After that what you can do is to take the details from the user given in the e.g. below
public double a;
Calendar c = Calendar.getInstance();
system.out.println(" enter your date of birth);
System.out.println("YEAR : " + c.get(Calendar.YEAR));
System.out.println("MONTH : " + c.get(Calendar.MONTH));
System.out.println("DAY_OF_MONTH : " + c.get(Calendar.DAY_OF_MONTH));
what you can do is to create the select case and create the different birth years as the options so if any of the matching value matches the select case e.g. case 1:2010
System.out.println("Your age is: DAYS=MONTH*30" +a);
. If the user enters the option say 2010 then the day will be calculated on the basis of the DAYS=MONTH*30.
If the user takes the value of say 2009 then you must put the loop as DAYS=MONTH*30+365;
So just try with this solution hope it may work for you.
|Tags: java, java programme, programming|
|Thread Tools||Search this Thread|
|Similar Threads for: "I need help on age calculation java programme"|
|Thread||Thread Starter||Forum||Replies||Last Post|
|How to records programme ON TATA Sky ?||Aadi||India BroadBand||1||01-09-2009 03:44 PM|
|transfer programme between two computers||oumara.mamane@yahoo.||Operating Systems||2||11-08-2009 08:27 PM|
|Calculator Programme in C #||Giriraj||Software Development||2||30-03-2009 02:38 PM|
|Prime Number programme in C#||Harshit||Software Development||2||14-11-2008 12:09 PM|
|Dell YouthConnect programme||Udumbu||Portable Devices||0||31-10-2008 05:19 PM|