Professional Documents
Culture Documents
Year :2023-24
4. Group members
Roll
Sr.No. Name of Group members Enrollment no. no.
Activity Name of
Details of activity Activity start complete Responsible
Date date member
Dhole
Report 1-10-23 20-10-23 Rameshwar
1 Internet Google 1
1.0 Rationale :
The rationale behind developing a BMI Calculator mobile application is to
leverage the widespread usage of smartphones for health and fitness
monitoring. By providing users with a convenient tool on their mobile
devices, they can easily track their BMI and make informed decisions about
their health.
Roll
Sr.No. Name of Group members Enrollment no. no.
Acticity_main.xml code: -
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:background="@drawable/background"
tools:context=".MainActivity">
<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
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"
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"
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: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"
android:background="@drawable/custombutton"
android:textSize="25sp"
android:textColor="#000"
android:textStyle="bold"
android:layout_marginTop="30dp"
></Button>
</LinearLayout>
Activity_main.java code: -
@Override
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Button btnRes,btnReset;
edWeg=(EditText) findViewById(R.id.edweg);
txtInter=(TextView) findViewById(R.id.txtinter);
txtRes=(TextView) findViewById(R.id.txtres);
btnRes.setOnClickListener(new View.OnClickListener() {
@Override
if(strweg.equals("")){
edWeg.requestFocus();
return;
if(strhei.equals("")){
return;
txtInter.setText(interpreteBMI(bmiVlaue));
txtRes.setText("BMI= "+bmiVlaue);
});
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
edHei.setText("");
edWeg.setText("");
txtInter.setText("");
txtRes.setText("");
});
return "Underweight";
return "Normal";
}
else if(bmiValue <30){
return "OverWeight";
else
return "Obese";
Activit_main.java code
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
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;
}
if(strhei.equals("")){
edHei.setError("Please Enter Your Height");
edHei.requestFocus();
return;
}
}
});
btnReset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
edHei.setText("");
edWeg.setText("");
txtInter.setText("");
txtRes.setText("");
}
});
}
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";
}
}
OUTPUT: -