Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Question 1: BMI (Body Mass Index) Calculator (use if if-else) You are developing a program that calculates a person's BMI based on their weight
Question 1: BMI (Body Mass Index) Calculator (use "if" "if-else") You are developing a program that calculates a person's BMI based on their weight (in kilograms) and height (in meters). Write a Java program that takes the weight and height as input and calculates the BMI using the formula: BMI = weight/ (height^2). The program should then categorize the BMI as follows: Underweight: BMI less than 18.5 Normal weight: BMI between 18.5 and 24.9 Overweight: BMI between 25 and 29.9 Obesity: BMI 30 or greater Display the BMI in the format of %.2f. Please check the usage of System.out.format. After showing the user the category, you ask the user a question "do you some tips according to your BMI?". If the user input yes/y/Y, you print the follow information accordingly: Underweight: "Please eat well and do more excises." Normal weight: "Congratulations, you are doing fairly well. Keep on going." Overweight: "Please watch out what you eat and do more excises!" Obesity: "Please contact our experts for professional help." If the user input anything else, you print the message "Nice to meet you too. Bye!" The output is shown as following (Here show imcomplete combinations of BMI and yes/Y/y and some cases of non yes/Y/y inputs.) Figure 1: BMI = "Underweight", tip="yes" Welcome to BMI Calculator Enter weight (in kilograms): 45 Enter height (in meters): 1.60 BMI: 17.58 Category: Underweight do you some tips according to your BMI? yes Please eat well and do more excises. Welcome to BMI Calculator Enter weight (in kilograms): 68 Enter height (in meters): 1.70 BMI: 20.76 Category: Normal weight do you some tips according to your BMI? Congratulations, you are doing fairly well. Keep on going. Figure 3: BMI = "Overweight", tip "Y" Welcome to BMI Calculator Enter weight (in kilograms): 80 Enter height (in meters): 1.70 BMI: 27.68 Category: Overweight do you some tips according to your BMI? Please watch out what you eat and do more excises! Figure 4: BMI "Obesity", tip "yes" Welcome to BMI Calculator Enter weight (in kilograms): 200 Enter height (in meters): 1.80 BMI: 61.73 Category: Obesity do you some tips according to your BMI?- yes Please contact our experts for professional help. Figure 5: BMI-"Obesity", tip "Yes" (notice case sensitive) Welcome to BMI Calculator Enter weight (in kilograms): 200.05 Enter height (in meters): 1.00 BMI: 61.74 Category: Obesity do you some tips according to your BMI? Yes Nice to meet you too. Bye!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here is the Java program that implements the BMI calculator according to the provided requirements j...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