Tuesday, February 18

BMI Calcuation Program in Java




Hi ALL,

Here I wrote a program for simple BMI Calculation details in java.


/**
 *
 * @author Balamurgan M
 */
import java.util.Scanner;

public class BMICalc {
    public static void main(String arg[]){
        System.out.println("Enter your weight:  \t ");
        Scanner in=new Scanner(System.in);
        double weight=in.nextDouble();
        System.out.println("Enter your height: \t ");
        double height=in.nextDouble();
       
        double HinM=height/100;
        System.out.println(" Your Height in Meter's "+HinM);
        double bmi=weight/ (HinM * HinM);
        System.out.println("Enter your age: \t");
        int age=in.nextInt();
        if(age<=16)
            System.out.println("you are serious underweight "+bmi);
        else if((age>16)&&(age<=18))
            System.out.println("you are underweight "+bmi);
        else if((age>18)&&(age<=24))
            System.out.println("you are normal weight "+bmi);
        else if((age>24)&&(age<=29))
            System.out.println("you are overweight "+bmi);
        else if((age>29)&&(age>35))
            System.out.println(" you are seriously overwight "+bmi);
        else
            System.out.println(" you are gravely overweight "+bmi);
    }
   
}

No comments:

Post a Comment

Backup files to google drive using PHP coding

 Dear All, To backup files to Google Drive using PHP coding, you can use the Google Drive API and the Google Client Library for PHP. Here...