1

I'm supposed to write an application that calculates the Body Mass Index (BMI) for the user, using centimeters for height, and kilograms for weight.. Basically, I'm stuck here.. I have no clue what I'm supposed to do next.. Or if it's even correct so far.. Any help?

         /*** This application will calculate my BMI when I input my height and weight ***/
          import java.util.Scanner;
          public class BMI {
          public static void main(String[] args) {
                  Scanner scanner = new Scanner(System.in);
              /***Data input of user***/        
                  System.out.print("What is your weight in kilograms?");
                  int weight = 104;
                  weight = scanner.nextInt();

                  System.out.print("What is your height in centimeters?");
                  int height = 198;
                  height = scanner.nextInt();

                  double bmi = (weight)/((Math.pow(((double)height/100),2)));


          }


}
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by Taywin
1

What you need to do is to display the value of bmi you just computed using System.out.println()? You could put a string or primitive number variable inside the () to display it. You could also simply concatenate it with another String (i.e. System.out.println("abcdd"+3);)

Edited by Taywin

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.