Assignemnt #48 - Quiz

Code

    /// Name: Caelan Dorstad
    /// Period: 6
    /// Program Name: BMI
    /// File Name: BMI.java
    /// Date Finished: 10/21/2015
    
    import java.util.Scanner;

    public class BMI{
        public static void main(String[] args){
            
            double height, weight, bmi;
            Scanner keyboard = new Scanner(System.in);
            
            System.out.print("Your height in m: ");
            height = keyboard.nextDouble();
            
            System.out.print("Your weight in kg: ");
            weight = keyboard.nextInt();
            
            System.out.println();
            
            bmi = weight / (height*height);
            
            if ( bmi < 15.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: very severely underweight");
            }
            
            else if ( bmi >= 15.0 && bmi <16.1 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: severely underweight");
            }
            
            else if ( bmi >= 16.1 && bmi < 18.5 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: underweight");
            }
            
            else if ( bmi >= 18.5 && bmi < 25.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: normal weight");
            }
            
            else if ( bmi >= 25.0 && bmi < 30.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: overweight");
            }
            
            else if ( bmi >= 30.0 && bmi < 35.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: moderately obese");
            }
            
            else if ( bmi >= 35.0 && bmi <40.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: severely obese");
            }
            
            else if ( bmi >= 40.0 ){
                System.out.println("Your BMI is " + bmi );
                System.out.println("BMI Category: very severely obese");
            }
        }
    }
    

Picture of the output

Assignment 39