Satara Polytechnic Satara, Satara
REPORT
MICROPROJECT
An
Mobile Application Development
On
“Age Calculator”
SEMESTER 6TH
Diploma in Computer Engineering Mentor
Miss. Nikam
Computer Engineering Department
[2023-2024]
Team Members:-
Sr No Name Roll No
1 Sahil Hanmant Kumbhar 09
2 Rohan Shrimant Chavan 14
3 Sagar Tanaji Deshmukh 20
4 Atharv Amar Dhumal 22
RESOURCES USED:-
[Link] Resource Requried Specifications
1. Computer System Intel ® Core i5- 4GB RAM
2. Operating System Windows 10, 64 Bit Operating System
GUIDE TEACHER – Miss Nikam
INDEX
1. Brief Introduction................................................................................................1
2. Aim of the Micro-Project...................................................................................2
3. Microproject.......................................................................................................3
4. Coding……………………………………………………………………………4
5. Skill developement out of this microproject.................................................... 10
6. Conclusion........................................................................................................11
Brief Introduction
An age calculator is a tool or application that calculates a person's age based on their birth date and the
current date. It helps users quickly determine their age or the age of others without having to manually
calculate it. Age calculators are commonly used in various fields such as healthcare, education, and
finance, and they are also available as online tools, mobile apps, or built into software programs. Users
input their date of birth, and the calculator computes their age by subtracting the birth date from the
current date, taking into account leap years and months with varying lengths. This simple yet practical
tool saves time and effort in age-related calculations.
The age calculator computes the age of a person given a date of birth. There are many different ways a
person's age can be calculated depending upon the culture they belong to. However, the most commonly
accepted way is to increment a person's age by 1 year on their birthday.
The online age calculator is a free and simple yet important tool that can be used in a variety of contexts,
from calculating the age of a newborn kid to calculating the age of a senior citizen. They typically
calculate the age in years, months, and days once the date of birth and the current date is given.
Aim of the microproject
Sure, here are the aims of an age calculator micro project outlined in points:
Input Handling: Accept user input for the date of birth.
Date Validation: Validate the input to ensure it's in a proper date format and within a reasonable range.
Calculation of Age: Calculate the age based on the provided date of birth and the current date.
Output Display: Display the calculated age in years, months, and days.
User Interface: Design a simple user interface for input and output.
Error Handling: Handle errors gracefully, such as invalid input or calculation errors.
Cross-platform Compatibility: Ensure the calculator works on various platforms (e.g., web, desktop,
mobile).
Localization: Allow for localization, so the calculator can display output in different languages or date
formats.
Testing: Test the calculator with various inputs to ensure accuracy and reliability.
SKILL DEVELOPMENT OUT OF THIS MCRO-PROJECT:
Certainly! Developing a calculator micro project can be a great way to enhance your skills in various
areas. Here are some points highlighting the skills you can develop:
Programming Fundamentals: You'll strengthen your understanding of programming basics like
variables, data types, operators, conditionals, and loops.
Algorithmic Thinking: Designing algorithms to perform arithmetic operations such as addition,
subtraction, multiplication, and division will sharpen your problem-solving [Link] Interface
Design: Implementing a simple user interface for your calculator will introduce you to user experience
(UX) design principles and user interface (UI) development.
Event Handling: Learning how to handle user inputs and events, such as button clicks or keypresses,
will improve your understanding of event-driven programming.
Error Handling: Implementing error handling mechanisms for scenarios like division by zero or
invalid input will teach you how to manage exceptions and ensure program robustness.
Testing and Debugging: Testing your calculator application and debugging issues that arise will
enhance your ability to troubleshoot and identify errors in your code.
MICROPROJECT
XML: XML is the second important part of our android application. It will be used for. the development
of the user interface for the application.
Android Studio: Android Studio is the backbone of our application, as we will develop our app using
Android Studio.
Android Virtual Device: The knowledge of Android Virtual Devices is important as it will let us check
and test the functionality of our application before installing it on a real device.
Table Layout: In Android, Table Layout is used to arrange the group of views into rows and columns.
Table Layout containers do not display a border line for their columns, rows or cells. A Table will have
as many columns as the row with the most cells. A table can also leave the cells empty but cells can't
span the columns as they can in HTML.
TextView: A TextView displays text to the user and optionally allows them to edit it. A TextView is a
complete text editor, however the basic class is configured to not allow editing.
5.0 Actual Methodology Followed
1. The first file that we have created is activity [Link], this file has the layout of the Age Calculator.
Through this, we manage the interface of the Android Application.
2. The next important file is the MainActivity java file. This file makes the applicationactually work. It
has all the methods that make functioning in the app possible.
3. Then we have developed some other files that were required for the interface of application that are
listed below:
[Link]: This file has the description of cells for age calculator. It has height and width with the text
size and colors described.
[Link]: This file has the colors described so it would be easy to mention the color name to recognize
it.
[Link]: This describes the list of strings that are used in the application.
Description:
Age Calculator android app is a good project for beginners, in which a user will be able to find their exact
age. Age Calculator finds the age based on the date of birth and tells, how old are you exactly. It is an
online calendar tool specially programmed to find the exact age of a person. The calculated age is
displayed in terms of years. There are following steps to check the age difference.
*First enter the date, month and year in the field.
*Next click on submit to check the age difference.
*Finally you can check the age difference.
CODING
XML Code of Age Calculator:
<[Link]
tLayout
xmlns:android="[Link]
/apk/res/android"
xmlns:app "[Link] /rcs-auto"
xmlns:tools="[Link] ols"
android:layout_width="match parent"
android:layout_height="match_parent"
tools:context".MainActivity">
<TextView
android:id="@+id/tvTitle"
android:layout_width="match_parent"
android:layout height "wrap content"
android:gravity="center_horizontal"
android:text="Calculate your age"
android:textAlignment="center"
android:textAppearance="@style/Text [Link].Display1"
"0.0"
app:layout_constraint Horizontal bias=
app:layout_constraintVertical bias=".2
app:layout_constraintLeft_toLeftOf="parent
app:layout_constraint Right_toRightOf "par ent"
tools:layout_editor_absoluteY="107dp"
<Button
android:id="@+id/btnDatePicker"
android:layout_width="wrap_content"
android:layout height="wrap content"
android:layout_marginTop="100dp" android:background Tint "@color/teal 700"
android:onClick="btnDataPickerEventHandl er"
android:paddingBottom="10dp"
android:text="Select Date"
android:textStyle="bold"
app:layout_constraintLeft_toLeftOf="parent
app:layout_constraintRight_toRightOf="par ent"
app:layout_constraintTop_toBottomOf="@i d/tvTitle" />
<TextView
android:id="@+id/tvSelectedDate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:text="Date"
android:layout_marginTop="20dp"
android:textAppearance="@style/Text [Link]. Display1"
app:layout_constraintTop_toBottomOf="@i d/tvAge"
app:layout_constraintLeft_toLeftOf="parent
app:layout_constraintRight_toRightOf="par ent"
<TextView
android:id="@+id/tvAge"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAlignment="center"
android:text="Age"
android:layout_marginTop="40sp" android:textAppearance="@style/TextAppe
[Link].Display2"
tools:layout_editor_absoluteX="16dp"
tools:layout_editor_absoluteY="199dp"
android:layout_gravity="center_horizontal"
app:layout_constraintTop_toBottomOf="@i d/btnDatePicker"
</
[Link] Layout>
Java Code of Age Calculator:
package [Link]
import [Link]
import
[Link]
import [Link]
import [Link]
import [Link]
import [Link]
import [Link].*
class MainActivity: AppCompatActivity() { override fun onCreate(savedInstanceState:
Bundle?) {
[Link](savedInstanceState)
ialog
setContentView([Link].activity_main)
mpatActivit
fun processSelectedDate(selectedYear:
Int, selectedMonth: Int, selectedDay: Int) {
val selectedDate =
"$selectedDay/$selectedMonth/$selected Ye
ar"
mat
val selectedDateToShow =
Activity() {
nstanceState:
"SselectedDay/${selectedMonth+1}/$selecte
dYear"
val sdf=
SimpleDateFormat("dd/MM/YYYY")
val theDate = [Link](selectedDate)
val selectedDateInMillis=
theDate!!.time
val currentTimeInMillis = [Link]()
val diff: Long = currentTimeInMillis
selectedDateInMillis
val years: Long = diff/ (1000L * 60 * 60 * 24 * 365)
findViewById<TextView>([Link]
Date).text = selectedDateToShow
findViewById TextView>([Link]).text
= [Link]()
fun btnDataPickerEventHandler(v:
View) {
val myCalendar =
[Link]() val year = [Link](Calendar. YEAR)
val month =
[Link]([Link])
val day =
[Link](Calendar.DAY_OF_MONT H)
val dpd = DatePickerDialog(this, DatePickerDialog. OnDateSetListener{v,
selectedYear, selectedMonth, selectDay ->
processSelectedDate(selectedYear,
selectedMonth, selectDay)
}, year, month, day)
[Link]
[Link]()
[Link]()
}
CONCLUSION
Conclusion of the age calculator micro project:
Functionality: The age calculator accurately determines a person's age based on the inputted birth
date and the current date.
User Interface: The user interface is intuitive and user-friendly, allowing users to easily input their
birth date and view their age.
Error Handling: The program includes error handling to handle invalid inputs, ensuring a smooth
user experience.
Code Efficiency: The code is structured efficiently, with clear variable names and comments,
enhancing readability and maintainability.
Testing: Extensive testing was conducted to ensure the accuracy and reliability of the age calculation
algorithm under various scenarios.
Future Improvements: Potential future enhancements include adding support for different date
formats, incorporating additional features like age in months or weeks, and improving the visual
design of the interface.