Assignment #48: BMICategories

Code

import java.util.Scanner;

public class BMI {

    public static void main (String[] args) {Scanner kb = new Scanner(System.in);
        
        double height, weight, bmi;
        
        System.out.println("What is your height in meters?");
        height = kb.nextDouble();
        
        System.out.println("What is your weight in kg?");
        weight = kb.nextDouble();
        
        bmi = (weight / (Math.pow(height, 2)));
        
        System.out.println("Your BMI is: " + bmi);
        
        System.out.println("Your BMI category is: ");
        
            if (bmi <= 15) {
        
                System.out.println("extremely underweight \n");
            
            }
        
            if (bmi > 15 && bmi <= 16) {
        
                System.out.println("severely underweight \n");
            
            }
        
            if (bmi > 16 && bmi <= 18.5) {
        
                System.out.println("underweight \n");
            
            }
        
            if (bmi > 18.5 && bmi <= 25) {
        
                System.out.println("normal \n");
            
            }
        
            if (bmi > 25 && bmi <= 30) {
        
                System.out.println("overweight \n");
            
            }
        
            if (bmi > 30 && bmi <= 35) {
        
                System.out.println("moderately obese \n");
            
            }
        
            if (bmi > 35 && bmi <= 40) {
        
                System.out.println("severely obese \n");
            
            }
        
            if (bmi > 40) {
        
                System.out.println("morbidly obese \n");
        
            }
                                             
        }
    
    }
        
    

Picture of the output