Getter Methods

DEVELOP THE FOLLOWING CLASS AND AN APPROPRIATE TEST DRIVER.

Develop an immutable Person class that contains the following values:

  • name
  • age
  • height_weight

Include in the class:

  • appropriate constructor
  • getter methods
  • toString method
  • BMI method
  • isOverweight method (returns Boolean value)

HeightAndWeight class very similar to the XYCoord class from the lecture slides. The class was to have an appropriate constructor, setters and getters, and a print method that would print “5 ft 7 ins. 140 lbs.”.

The other part of the lab is to write a test driver for it, i.e., a separate main program that creates an object of type HeightAndWeight and shows that all of the methods work.

Calculation of Body-Mass Index (BMI)

Body Mass Index is a simple calculation using a person’s height and weight. The formula is

BMI = kg/m2

where kg is a person’s weight in kilograms and m2 is their height in metres squared. A BMI of 25.0 or more is overweight, while the healthy range is 18.5 to 24.9. BMI applies to most adults 18-65 years.

Use of Following Private Methods

double inchestoMeters(int h)

double poundsToKg(int lbs)

Conversion Values

1 inch is equal to 0.0254 meters

1 pound is equal to 0.45359237 kilograms (kg)

Do you need help with this assignment or any other? We got you! Place your order and leave the rest to our experts.

Quality Guaranteed

Any Deadline

No Plagiarism