Answered step by step
Verified Expert Solution
Question
1 Approved Answer
NOTE 2: (1) Neither use nor import any other library/package aside from: java.util.Scanner; (ii) Neither implement nor use any custom/user-defined function(s) for any task
NOTE 2: (1) Neither use nor import any other library/package aside from: java.util.Scanner; (ii) Neither implement nor use any custom/user-defined function(s) for any task herein. (iii) with reference to each task herein, do NOT implement or use any of the following constructs: iterations/loops (for {}, while {}, etc.). 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." I 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. Figure 2: BMI = "Normal", tip = "y" Welcome to BMI Calculator ook ******** Enter weight (in kilograms): 60 Enter height (in meters): 1.70 BMI: 20.76 ******** Welcome to BMI Calculator -******* Category: Normal weight do you some tips according to your BMI? y Congratulations, you are doing fairly well. Keep on going. Figure 3: BMI= "Overweight", tip= "Y" ******* Enter weight (in kilograms): 80 Enter height (in meters): 1.70 BMI: 27.68 ook Figure 4: BMI = "Obesity", tip = "yes" 000 *********** Welcome to BMI Calculator *|*|*|******- **** Category: Overweight do you some tips according to your BMI? Y Please watch out what you eat and do more excises! 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.80 BMI: 61.74 Category: Obesity do you some tips according to your BMI? Yes Nice to meet you too. Bye!
Step by Step Solution
★★★★★
3.43 Rating (156 Votes )
There are 3 Steps involved in it
Step: 1
Question 1 import javautilScanner public class BMICalculator public stati...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