In this application we calculate total year, months and day of our age. You simply enter Data of Birth to calculate it. Let start the fun First we Create AgeCalcualtion class where we add all calculation method to calculate Year, Months and Day from date of Birth public class AgeCalculation { private int startYear; private int startMonth; private int startDay; private int endYear; private int endMonth; private int endDay; private int resYear; private int resMonth; private int resDay; public String getCurrentDate() { Calendar c=Calendar.getInstance(); endYear=c.get(Calendar.YEAR); endMonth=c.get(Calendar.MONTH); endMonth++; endDay=c.get(Calendar.DAY_OF_MONTH); return endDay+":"+endMonth+":"+endYear; } public void setDateOfBirth(int sYear, int sMonth, int sDay) { startYear=sYear; startMonth=sMonth; startMonth++; startDay=sDay; } public void calcualteYear() { resYear=endYear-startYear; } public void calcualteMonth() { if(endMont...
Comments
Post a Comment