(DERDOURI) DEVOAM 22 23 M209 EFM v2 Eléments de Correction
(DERDOURI) DEVOAM 22 23 M209 EFM v2 Eléments de Correction
(DERDOURI) DEVOAM 22 23 M209 EFM v2 Eléments de Correction
@Override
public String toString() {
return String.format("%d;.2f", getCode(), getPrix());
}
@Override
public boolean equals(Object obj) {
if (obj == null)
return false;
@Override
public double prixProduit() {
return getPrix() * (1 + remise / 100);
}
}
import java.io.*;
import java.util.ArrayList;
return -1;
}
liste.add(p);
}
if (indice == -1)
return false;
liste.remove(indice);
return true;
}
return nombre;
}
<EditText
android:id="@+id/etWeight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:hint="Weight (Pounds)"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<EditText
android:id="@+id/etHeight"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:ems="10"
android:hint="Height (Inches)"
android:inputType="textPersonName"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etWeight" />
<Button
android:id="@+id/btnOK"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="16dp"
android:layout_marginEnd="16dp"
android:text="OK"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/etHeight" />
</androidx.constraintlayout.widget.ConstraintLayout>
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
etWeight = findViewById(R.id.etWeight);
etHeight = findViewById(R.id.etHeight);
btnOK = findViewById(R.id.btnOK);
btnOK.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
double weight = Double.parseDouble(etWeight.getText().toString()),
height = Double.parseDouble(etHeight.getText().toString()),
bmi = weight / (703 * Math.pow(height, 2));
String etat;