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)));


          }


}

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);)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.