Professional Documents
Culture Documents
A MICRO-PROJECT REPORT ON
“BMI Calculator”
SUBMITED BY:-
RUTIK THAKARE
ENROLLMENT NO:-
2216620128
UNDER GUIDANCE OF
Prof mrs. SHRADDHA PARDESHI
THIS IS CERTIFY THAT THE MICROPROJECTIS
SUCCESSFULLY SUBMITTED BY,
• Rutik Thakare
3. Course Outcomes :-
1) Configure Android environment and development
tools.
2) Develop rich user Interfaces by using layouts and
controls.
3) Use User Interface components for android
application development
4. Proposed Methodology :-
At first we created a group of 4 members for making
project. After that We collected rough data for making a
project. Then studied carefully on that collected data
and implement in our project respectively.
5. Resources required :-
No Resource Specification
1 Websites www.w3schools.com
www.tutorialspoint.com
www.javatpoint.com
3. Course Outcomes :-
5
3) Use User Interface components for android
application development.
4. Literature Review :-
6
5. Code
activity_main.xml
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="BMI Calculater"
android:textSize="45sp"
android:textColor="#ffff"
android:layout_marginBottom="20dp"
android:textStyle="bold"></TextView>
<LinearLayout
7
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="20dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Weight"
android:textSize="30sp"
android:textColor="#ffff"
></TextView>
<EditText
android:id="@+id/edweg"
android:layout_width="95dp"
android:layout_height="55dp"
android:inputType="numberDecimal"
android:background="#ffff"
android:textSize="25sp"
android:hint="KG"
android:gravity="center"
android:layout_marginLeft="80dp"></EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
8
android:layout_marginBottom="20dp"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Height"
android:textSize="30sp"
android:textColor="#ffff"
></TextView>
<EditText
android:id="@+id/edhei"
android:layout_width="95dp"
android:layout_height="55dp"
android:inputType="numberDecimal"
android:background="#ffff"
android:textSize="25sp"
android:hint="cm"
android:gravity="center"
android:layout_marginLeft="80dp"></EditText>
</LinearLayout>
<Button
android:id="@+id/btnres"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="Result"
android:background="@drawable/custombutton"
android:textSize="25sp"
9
android:textColor="#000"
android:textStyle="bold"
android:layout_marginTop="30dp"
></Button>
<TextView
android:id="@+id/txtinter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="Enter Your Detail "
android:textSize="25sp"
android:textStyle="bold"
android:textColor="#ffff"
android:layout_marginTop="30dp"></TextView>
<TextView
android:id="@+id/txtres"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:hint="BMI = ? "
android:textSize="25sp"
android:textStyle="bold"
android:textColor="#ffff"
android:layout_marginTop="30dp"></TextView>
<Button
android:id="@+id/btnreset"
android:layout_width="120dp"
android:layout_height="60dp"
android:text="Reset"
10
android:background="@drawable/custombutton"
android:textSize="25sp"
android:textColor="#000"
android:textStyle="bold"
android:layout_marginTop="30dp"
></Button>
</LinearLayout>
Main_Activity.java
package com.example.bmicalculater;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
11
final EditText edWeg,edHei;
final TextView txtRes,txtInter;
Button btnRes,btnReset;
edWeg=(EditText) findViewById(R.id.edweg);
edHei= (EditText) findViewById(R.id.edhei);
txtInter=(TextView) findViewById(R.id.txtinter);
txtRes=(TextView) findViewById(R.id.txtres);
btnRes.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
if(strweg.equals("")){
edWeg.setError("Please Enter Your Weight
");
edWeg.requestFocus();
return;
}
12
if(strhei.equals("")){
edHei.setError("Please Enter Your Height");
edHei.requestFocus();
return;
}
txtInter.setText(interpreteBMI(bmiVlaue));
txtRes.setText("BMI= "+bmiVlaue);
}
});
btnReset.setOnClickListener(new
View.OnClickListener() {
@Override
public void onClick(View v) {
edHei.setText("");
edWeg.setText("");
txtInter.setText("");
txtRes.setText("");
}
});
13
}
public float BMICalculate(float weight,float height){
return weight / (height * height);
}
public String interpreteBMI(float bmiValue){
if( bmiValue <16){
return "Servely Underweight";
}
else if(bmiValue <18.5){
return "Underweight";
}
else if(bmiValue < 25){
return "Normal";
}
else if(bmiValue <30){
return "OverWeight";
}
else
return "Obese";
}
}
14
5. Output :-
15
Entering the value in empy fileds.
16
Actual Ouput with BMI value.
17
6.0) Conclusion:-
BMI is a reasonable indicator of body fat for both adults and children.
Because BMI does not measure body fat directly, it should not be
used as a diagnostic tool.
18