1. Declare three classes by transforming the above class diagram.
2. You must declare the following methods in the BMI class.
2.1 Create a constructor BMI(w:double, h:double) for setting the initial value of weight and height of BMI variables perceptively.
2.2 getWeight() method for getting and returning a value of weight
2.3 getHeight() method for getting and returning a value of height
2.4 BMIResult() method to compute the BMI according to BMI formula (in example 1) and return the result of the BMI formula.
3. You must declare the following methods in the “HealthyBMI” class.
3.1 getBMI() method for getting and returning a value bmi
3.2 setBMI(inputBMI:double) method for setting a value of bmi
3.3 inputBMI() method for get BMI value from the keyboard and assign value to bmi (class variable)
3.4 showResult()
Show the result from the BMI that you are healthy or not by using the condition
- If the bmi is less than or equal to 18.5, the method display “ You are under weight”
If the bmi is between 23.40 and 18.5, the method display “You are normal weight “
If the bmi is more than or equal to 23.40, the method display “You are overweight”
4. You must declare a class “MainBMI” that contains the following task,
4.1 Declare main() method.
4.2 Create the BMI object and initialize the weight and height of BMI via constructor
4.4 Compute BMI with the formula
4.5 Display the result of BMI formula
4.6 Create the HealthyBMI object.
4.7 Input the BMI value
4.8 Show the result of the BMI that you are healthy or not
Remark: Calling the appropriate methods
5. Expected result,
EQUIPMENTS REQUIRED
• PC running MS Windows operating system
• BlueJ or Eclipse , JDK 6.0
• E-learning : wizlearn