Lab 2 Feedback Marking scheme: -------------------- 2 / 2 -passes all unit tests AND -none or very minor style errors -------------------- TA Comments: -------------------- Style checker output: No style errors found by checkstyle; TAs, please check for poorly named variables, unusual programming constructs, and other style errors. -------------------- Unit tester output: Passed all unit tests. -------------------- Your submission: package implementation; public class Person { private static final double LOWERBOUND = 18.5; private static final double MID = 25.0; private static final double UPPERBOUND = 30.0; private String n; private double weight; private double height; private double bmi; /** * just deploys inputed string and assigns it to variable 'n' * * @param name an inputed string */ public Person(String name) { n = name; } /** * retrieves value of 'n' * @return n value */ public String getName() { return n; } /** * retrieves value of 'weight' * @return valid weight value entered */ public double getWeight() { return weight; } /** * retrieves value of 'height' * @return valid height value entered */ public double getHeight() { return height; } /** * calculates bmi and rounds it up to tenth decimal place * @return bmi rounded up */ public double getBMI() { double bmi1 = (weight / Math.pow(height, 2)) * 10; double bmi2 = Math.round(bmi1); bmi = bmi2 / 10; return bmi; } /** * checks if the entered value for weight is valid * @param w that must be positive nonzero number * @throws IllegalArgumentException if the value 'w' is non-positive */ public void setWeight(double w) throws IllegalArgumentException { if (w <= 0) { throw new IllegalArgumentException("Illegal initial value " + w); } else { weight = w; } } /** * checks if the entered value for height is valid * @param h that must be positive nonzero number * @throws IllegalArgumentException if the value 'h' is non-positive */ public void setHeight(double h) throws IllegalArgumentException { if (h <= 0) { throw new IllegalArgumentException("Illegal initial value " + h); } else { height = h; } } /** * compares the calculated bmi and tries to fit it in a category by comparing it to the * final values initiated earlier * @return the category in which the person qualifies */ public String getInterpretationOfBMI() { this.getBMI(); if (bmi < LOWERBOUND) { return "underweight"; } else if (bmi < MID) { return "normal"; } else if (bmi < UPPERBOUND) { return "overweight"; } else { return "obese"; } } }