Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



I need help on age calculation java programme

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 08-12-2010
Member
 
Join Date: Dec 2010
Location: In Oman Heart
Posts: 5
idea I need help on age calculation java programme
  

Hello everyone,

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.

Reply With Quote
  #2  
Old 15-12-2010
Member
 
Join Date: Apr 2009
Posts: 567
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
using System.calendar;
class calendar
{
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 07:35 PM.