Question
First step is to create a class called BodyMassIndex (BodyMassIndex.java) which will not contain a main. The BodyMassIndex class will be very simple which will
First step is to create a class called BodyMassIndex (BodyMassIndex.java) which will not contain a main. The BodyMassIndex class will be very simple which will contain three private instance variables: o studentName as a String o height as a double o weight as a double The following public methods will have to be implemented: o A default constructor o A parameterised constructor o Three set methods (mutators) o Three get methods (accessors) o deriveBodyMassIndex value returning method* o deriveRatingvalue returning method** *You will create a public value returning method deriveBodyMassIndex(), the body mass index can be derived from the instance variables height and weight. Typically we do not store calculated values in a database so the BMI will be derived via your deriveBodyMassIndex() method. Do not store the body mass index as an instance variable. **You will also create a public value returning method deriveRating() to return the BMI rating Underweight, Normal, Overweight etc (see assignment one). The rating can be derived from the BMI and as with the BMI above typically we do not store calculated values in a database and the rating will be retrieved via your deriveRating() method. Use constants in the if statements for the grade boundaries. Hint: use deriveBodyMassIndex() method above in your deriveRating() method to calculate the BMI (we do not want to repeat any code in our program).
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