A Project Report On
“Age Calculator”
Downloaded by Adinath Khandare
INDEX
SR TOPIC PAGE
NO. NO.
1. Rationale 9
2. Aims/Benefits of the Microproject 9
3. Cource outcome achieved 9
4. Literature review 10
5. Introduction 11
6. Features 11
7. Source Code 12
8. Output 17
9. Future scope 19
10. Conclusion 20
11. References 20
Downloaded by Adinath Khandare
Introduction
An age calculator is an invaluable online tool that accurately
determines a person’s age based on their date of birth and the current
date. By taking into account leap years and different calendar systems,
this tool delivers precise results in years, months, and days. With just a
few clicks, individuals can input their birth date and the current date to
obtain reliable age calculations, saving time and effort. Age calculators
serve a variety of purposes, such as fulfilling legal or administrative age
requirements, facilitating event planning, or satisfying curiosity about
one’s exact age. Discover the convenience of this hassle-free tool that
provides quick and accurate age information, eliminating the need for
manual calculations
The Age Calculator Android app is designed to provide users with a
convenient and user-friendly tool for accurately calculating age based
on date of birth. This app serves a practical purpose by eliminating the
need for manual calculations and streamlining the process of
determining age, making it particularly useful for a wide range of
users, including individuals, professionals, and organizations.
Features of Age Calculator
1. Easy To Use.
2. Offline Functionality.
3. Accurate Age Calculation.
4. Save Time
Downloaded by Adinath Khandare
Source Code
Activity_main.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:id="@+id/selectedDateText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Select your birthdate"
android:textSize="18sp" />
<DatePicker android:id="@+id/datePicker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Downloaded by Adinath Khandare
android:layout_below="@id/selectedDateText"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp" />
<Button
android:id="@+id/calculateButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/datePicker"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text="Calculate Age" />
<TextView
android:id="@+id/resultText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/calculateButton"
android:layout_centerHorizontal="true"
android:layout_marginTop="16dp"
android:text=""
android:textSize="18sp" />
Downloaded by Adinath Khandare
</RelativeLayout>
MainActivity.java
package com.example.ap;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import java.util.Calendar;
public class MainActivity extends AppCompatActivity
private DatePicker
datePicker; private
TextView resultText;
protected void onCreate(Bundle savedInstanceState)
{ super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
datePicker = findViewById(R.id.datePicker);
Button calculateButton = findViewById(R.id.calculateButton);
resultText = findViewById(R.id.resultText);
calculateButton.setOnClickListener(new View.OnClickListener() {
Downloaded by Adinath Khandare
public void onClick(View v)
{ calculateAge();
});
private void calculateAge() {
int birthYear = datePicker.getYear();
int birthMonth = datePicker.getMonth();
int birthDay =
datePicker.getDayOfMonth(); Calendar
today = Calendar.getInstance(); int
currentYear = today.get(Calendar.YEAR);
int currentMonth = today.get(Calendar.MONTH);
int currentDay =
today.get(Calendar.DAY_OF_MONTH); int ageYears =
currentYear - birthYear;
int ageMonths = currentMonth - birthMonth;
int ageDays = currentDay - birthDay;
if (ageDays < 0)
{ ageMonths--;
ageDays +=
today.getActualMaximum(Calendar.DAY_OF_MONTH);
Downloaded by Adinath Khandare
}
Downloaded by Adinath Khandare
if (ageMonths < 0)
{ ageYears--;
ageMonths += 12;
String result = "Your age is: " + ageYears + " years, " + ageMonths +
" months, and " + ageDays + " days";
resultText.setText(result);
Downloaded by Adinath Khandare
Output
Emulator
Downloaded by Adinath Khandare
Skill developed / Learning out of this Micro-
Project:
There are so many thing that we learn from this project of
1. We learn that how to make the project in android.
2. How to do the testing of program in android studio.
3. How to collect the information and how to make
the presentation that we learn from this project.
4. We develop our logic implementation for programming
and coding.
5. We learn to Age Calculator.
6. We learn how to use correct data type in program.
8. This all thing we learn from this project.
Application
1. Mobile Application.
2. Health and Fitness.
3. Age Comparison.
4. Educational Tools.
5. Age Progression Visualization:
6. Legal Documentation.
7. Medical Records.
8. Legal Drinking and Voting Age Verification.
9. Government and Census Data.
Downloaded by Adinath Khandare
Future Scope
The future scope for an age calculator can include several enhancements and
additional features to make it more versatile and useful. Here are some ideas:
1. Integration with Calendar Apps: Enable the age calculator to sync with
popular calendar applications such as Google Calendar, Outlook, or Apple
Calendar. This integration can automatically fetch birthdates from contacts
or events, making age calculations seamless and reducing manual data entry.
2. Age-Based Reminders: Incorporate a feature that allows users to set
age- based reminders. For example, reminders for annual health check-
ups, insurance renewals, or important milestones like reaching retirement
age. Users can receive notifications based on the age calculated by the
tool.
3. Multiple Timezone Support: Extend the age calculator to support
calculations across different time zones. This feature can be beneficial for
global users who need to calculate ages or time intervals considering
time zone differences.
4. Age Group Analysis: Implement a feature to categorize age groups based
on calculated ages. This analysis can provide insights for demographic studies,
marketing strategies targeting specific age brackets, or personalized content
recommendations based on age groups.
5. Customizable Outputs: Allow users to customize the output format of age
calculations. Options could include displaying age in years, months, and days
or presenting it in a more user-defined format like "X years Y months Z days.
Downloaded by Adinath Khandare
Conclusion
In conclusion, the age calculator stands as a valuable and user-friendly tool
that simplifies age-related calculations and offers a range of functionalities
for users across different domains. Its accuracy in determining ages in
years, months, and days, coupled with features like time interval
calculations and customizable outputs, enhances productivity and
convenience for individuals, professionals, and businesses alike.
Looking ahead, the age calculator holds promising future scope for
integration with calendar apps, age-based reminders, multiple timezone
support, age group analysis, customizable outputs, historical age
calculations, API integration, and personalized age insights. These
enhancements not only elevate the tool's utility but also make it a versatile
solution for a wide range of age-related computations and applications.
Overall, the age calculator's evolution reflects ongoing advancements in
technology and user-centric design, empowering users with efficient and
accurate age calculations while paving the way for innovative
developments in the field of age-related tools and application
References
www.w3schools.com
www.campusify.co.in
Downloaded by Adinath Khandare