MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
GOVERNMENT POLYTECHNIC, VIKRAMGAD
MICRO PROJECT
Academic year: 2022-2023
TITLE OF PROJECT
Age Calculator
Program: Diploma in computer engineering
Program code: co
Course: Advance Java Programming
Course code: 22517
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
Certificate
This is to certify that Mr./Ms. Dubey Dibyas Sanjay Roll No. 3108
of second Semester of Diploma in …Fifth semester of diploma in
computer engineering …of Institute, Government Polytechnic,
Vikramgad (Code: 1547) has completed the Micro
Project satisfactorily in Subject Advance Java Programming
( 22517)–for the academic year 2022- 2023 as prescribed in the
curriculum.
Place: Vikramgad Enrollment No: 2015470057
Exam. Seat No: Date:
Subject Teacher Head of the Department Principal
2
MAHARASHTRA STATE BOARD OF TECHNICAL EDUCATION
Certificate
This is to certify that Mr./Ms. Yadav Sushil Amar Bahadur Roll No.
31036 of second Semester of Diploma in …Fifth semester of diploma
in computer engineering …of Institute, Government Polytechnic,
Vikramgad (Code: 1547) has completed the Micro
Project satisfactorily in Subject – Advance Java Programming (
22517) for the academic year 2022- 2023 as prescribed in the
curriculum.
Place: Vikramgad Enrollment No: 2015470088
Exam. Seat No: Date:
Subject Teacher Head of the Department Principal
3
Group
Sr. Name of Group Member Roll No. Enrollment No. Seat No.
1 DUBEY DIBYAS SANJAY
3108 2015470056
2 3128 2015470088
YADAV SUSHIL AMAR BAHADUR
Guided By: Mr [Link] Sir
4
• ABSTRACT
The age of a person can be counted differently in different cultures. This calculator is based
on the most common age system. In this system, age grows at the birthday. For example, the
age of a person that has lived for 3 years and 11 months is 3 and the age will turn to 4 at
his/her next birthday one month later. Most western countries use this age systemIn some
cultures, age is expressed by counting years with or without including the current year. In
some situations, the months and days result of this age calculator may be confusing,
especially when the starting date is the end of a month.
5
• INTRODUCTION
This solution is very basic and should be used for only learning the logic of calculation. I will
not recommend this method for production-class applications. Though it works fine but code
is not very readable. The low performance (not measured accurately) can be also a downside.
I have made some effort by adding Age class to make this solution look professional. I have
made the default constructor private and provided a constructor which accepts days,
months, years. We can add parameter validation as well so that it does not accept negative
values.
6
❖ Source code
import [Link];
import [Link].*;
import [Link].*;
public class AgeCalculation extends Applet implements ActionListener {
private static final long serialVersionUID = 1L;
private TextField field_birth_day, field_birth_month, field_birth_year, field_current_day,
field_current_month, field_current_year;
private Label label_age;
private Button button;
@Override
public void init() {
field_birth_day = new TextField(4);
field_birth_month = new TextField(4);
field_birth_year = new TextField(4);
field_current_day = new TextField(4);
field_current_month = new TextField(4);
field_current_year = new TextField(4);
label_age = new Label();
button = new Button("Process");
setLayout(new BorderLayout());
Panel panel, subpanel;
panel = new Panel(new BorderLayout());
subpanel = new Panel(new GridLayout(6, 1));
7
[Link](new Label("Enter the value of birth day:"));
[Link](new Label("Enter the value of birth month:"));
[Link](new Label("Enter the value of birth year:"));
[Link](new Label("Enter the value of current day:"));
[Link](new Label("Enter the value of current month:"));
[Link](new Label("Enter the value of current year:"));
[Link](subpanel, [Link]);
subpanel = new Panel(new GridLayout(6, 1));
[Link](field_birth_day);
[Link](field_birth_month);
[Link](field_birth_year);
[Link](field_current_day);
[Link](field_current_month);
[Link](field_current_year);
[Link](subpanel);
add(panel, [Link]);
panel = new Panel(new FlowLayout());
[Link](button);
add(panel);
panel = new Panel(new BorderLayout());
subpanel = new Panel(new GridLayout(1, 1));
[Link](new Label("Value of age:"));
[Link](subpanel, [Link]);
subpanel = new Panel(new GridLayout(1, 1));
[Link](label_age);
8
[Link](subpanel);
add(panel, [Link]);
[Link](this);
}
@Override
public void actionPerformed(ActionEvent actionEvent) {
int age, birth_day, birth_month, birth_year, current_day;
int current_month, current_year;
try {
birth_day = [Link](field_birth_day.getText());
birth_month = [Link](field_birth_month.getText());
birth_year = [Link](field_birth_year.getText());
current_day = [Link](field_current_day.getText());
current_month = [Link](field_current_month.getText());
current_year = [Link](field_current_year.getText());
} catch (NumberFormatException numberFormatException) {
return;
}
age=current_year-birth_year;
if(birth_month>current_month||(birth_month==current_month&&birth_day>current_day))
age=age-1;
label_age.setText([Link](age));
}
9
• Output :-
10
• Conclusion
At the end, exact human age is required to be calculated in many sectors for various purposes.
With the development of technology, use of software is preferred to manual hand calculation of
age. Although this Age Calculator Android Project is developed as a semester Android app
development project, it seems to have bright future and scope in all Android devices.
Age Calculator is an android app developed for the purpose of calculating exact age of user.
The application woks on any android devices fulfilling the basic requirement of app. It mainly
focuses at determination of exact age of user depending upon the input date of birth. Use of
application diminishes the manual age calculation procedure and roots out the error in age
calculation in android phones.
11
REFERENCE & SOURCES USED
• Website: -
1. [Link]/java
2. [Link]/socket-programming-in-java/
3. [Link]/java/java_network
• Software/Tools: -
1. Intellij IDE
12