Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a BMI calculator applications that reads the user\'s weight in kilograms

ID: 3637982 • Letter: C

Question

Create a BMI calculator applications that reads the user's weight in kilograms and height in meters, then calculates and displays the user's body mass index. Also, the application should display the following information from the Department of Health and Human Services, so the user can evaluate his/her BMI:
BMI Values
Underweight: less that 18.5
Normal: between 18.5 and 24.9
Overweight: between 25 and 29.9
Obese: 30 or greater


Formula for calculating BMI are
BMI = weightInKilograms
          heightInMeters x heightInMeters

The program is to be written in C++ langauge. I need some help, urgently. Homework is due tomorrow evening.




Explanation / Answer

Here is the Java code for Calculating BMI .. //Importing packages import java.util.*;//for Sacnner import java.text.*;//NumberFormat //Class public class BMIDemo { //Main method public static void main(String args[]) { //Scanner object for input Scanner scan=new Scanner(System.in); //for formatting number NumberFormat formatter=new DecimalFormat("#0.00"); //Declaring variables for height and weight double height,weight; //prompting for input System.out.print("Enter Height in Meters : "); height=scan.nextDouble(); System.out.print("Enter Weight in Kilograms : "); weight=scan.nextDouble(); double BMI; //Calculating BMI BMI=weight/(height*height); //Displaying BMI Basic values System.out.println(" Your Body Mass Index is :"+formatter.format(BMI)); System.out.println(" BMI VALUES"); System.out.println("Underweight: less than 18.5"); System.out.println("Normal: Between 18.5 and 24.9"); System.out.println("Overweight: between 25 29.9"); System.out.println("Obese: 30 or greater"); } }