Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need to add the following new constructor in the BMI class: /**Construct a BMI

ID: 3627396 • Letter: I

Question

I need to add the following new constructor in the BMI class:
/**Construct a BMI with the specified name, age, weight,
* feet and inches
*/
public BMI(String name, int age, double weight, double feet,
double inches)


This is my original BMI class and Test:

public class BMI {
private String name;
private int age;
private double weight;//in pounds
private double height;//in inches
public static double KILOGRAMS_PER_POUND = 0.45359237;
public static double METERS_PER_INCH = 0.0254;

public BMI(String name, int age, double weight, double height){
this.name = name;
this.age = age;
this.weight = weight;
this.height = height;
}
public BMI(String name, double weight, double height){
this(name, 20,weight, height);
}
public double getBMI(){
double bmi = weight * KILOGRAMS_PER_POUND /
((height * METERS_PER_INCH) *(height * METERS_PER_INCH));
return Math.round(bmi * 100) / 100.0;
}
public String getStatus(){
double bmi = getBMI();
if (bmi < 16)
return "seriously underweight";
else if (bmi < 18)
return "underweight";
else if (bmi < 24)
return "normal weight";
else if (bmi < 29)
return "overweight";
else if (bmi < 35)
return "seriously overweight";
else
return "gravely overweight";
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public double getWeight(){
return weight;
}
public double getHeight(){
return height;
}
}

________________________________________________________________________
public class UseBMIClass {
public static void main (String[] args){
BMI bmi1 = new BMI("John Doe", 18, 145, 70);
System.out.println("The BMI for " + bmi1.getName() + " is "
+ bmi1.getBMI() + " " + bmi1.getStatus());
}

}

Explanation / Answer

please rate - thanks

public class UseBMIClass {
public static void main (String[] args){
BMI bmi1 = new BMI("John Doe", 18, 145, 70);
System.out.println("The BMI for " + bmi1.getName() + " is "
+ bmi1.getBMI() + " " + bmi1.getStatus());
BMI bmi2 = new BMI("John Doe the 1st", 48, 145, 5,10);
System.out.println("The BMI for " + bmi2.getName() + " is "
+ bmi2.getBMI() + " " + bmi2.getStatus());

}

}

----------------------------

public class BMI {
private String name;
private int age;
private double weight;//in pounds
private double height;//in inches
public static double KILOGRAMS_PER_POUND = 0.45359237;
public static double METERS_PER_INCH = 0.0254;
public BMI(String name, int age, double weight, double feet,
double inches)
{this.name = name;
this.age = age;
this.weight = weight;
this.height = feet*12+inches;

}
public BMI(String name, int age, double weight, double height){
this.name = name;
this.age = age;
this.weight = weight;
this.height = height;
}
public BMI(String name, double weight, double height){
this(name, 20,weight, height);
}
public double getBMI(){
double bmi = weight * KILOGRAMS_PER_POUND /
((height * METERS_PER_INCH) *(height * METERS_PER_INCH));
return Math.round(bmi * 100) / 100.0;
}
public String getStatus(){
double bmi = getBMI();
if (bmi < 16)
return "seriously underweight";
else if (bmi < 18)
return "underweight";
else if (bmi < 24)
return "normal weight";
else if (bmi < 29)
return "overweight";
else if (bmi < 35)
return "seriously overweight";
else
return "gravely overweight";
}
public String getName(){
return name;
}
public int getAge(){
return age;
}
public double getWeight(){
return weight;
}
public double getHeight(){
return height;
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote