Question
A local health club wants to computerize the Body Mass Index (BMI) calculation for its members. The BMI calculator uses height and weight to calculate
A local health club wants to computerize the Body Mass Index (BMI)
calculation for its members.
The BMI calculator uses height and weight to calculate the BMI. The BMI
formula is:
Write java code for a BMI Class with both a default & non-default
constructor, standard accessors, mutators (with valid argument checking), a
method to return the BMI value, and a toString() method. The toString()
method should also return the Weight Status from the below table.
BMI Weight Status Categories
BMI Weight Status
Below 18.5 Underweight
18.5 -24.9 Normal
25 - 29.9 Overweight
30 & Above Obese
Here is a sample code segment you might use to test your BMI class.
BMI data1 = new BMI();
BMI data2 = new BMI(250, 60);
data1.setHeight(76);
double value=data2.getBMI();
System.out.println(data1);
System.out.println(data2);
8. Write your own class called WeatherStats to manage the ordered collection
of high temperatures. Have two constructors, one for a default maximum size
collection of 10, and the second for a user argument defined maximum size
collection. The user class will not do any prompting to the user or reading
of data, instead create the following methods:
boolean addNextTemp (double temp) add the temp to the next available
position in the collection, if room allows.
getMaxDifference() returns the maximum change in temperature (in
absolute value) on two consecutive days.
getMaxDiffDay() returns the day number for the second day of the two
consecutive days that the maximum change in temperature (in absolute value)
occurred.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started