Question: BMI class: create FindBMI() method to return BMI value according to height and weight. BMI.java public class BMI { private double height, weight; BMI(double height,
BMI class:
create FindBMI() method to return BMI value according to height and weight.
BMI.java
public class BMI { private double height, weight;
BMI(double height, double weight) { this.height = height; this.weight = weight; }
BMI() { height = 0.0; weight = 0.0; }
void setHeight(double updateHeight) { height = updateHeight; }
void setWeight(double updateWeight) { weight = updateWeight; } double getHeight() { return height; }
double getWeight() { return weight; }
// 1. create FindBMI() method to return BMI value according to height and weight: public String toString() { return "Height " + height + "\t Weight: " + weight; }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
