Answer to Question #250358 in Java | JSP | JSF for guru

Question #250358

Body Mass Index (BMI) is one of the criteria that is used to calculate whether one is fit or not basing on a person’s height (m) and weight (kg). The criterion is very simple; if one’s BMI is 25 or greater, it signifies overweight. A BMI less or equal to 18.5 indicates underweight. Lastly, a BMI greater than 30 shows obesity.

You have been requested to create a program that that helps the Namibian Defence Forces’ (NDF) Captain to calculates the BMI of a person (BMI = weight/height2) and also determine whether the person has also completed running 10 km in the required time. Men should complete 10km in less than 60 minutes for them to be accepted. Women should do that under 80 minutes. Both males and females are accepted if their BMI is less than 25 and greater than 18.5. For 2018 intake, there are already 6 males selected and 1 female. The values for gender, mass and weight are enter by user inputs


1
Expert's answer
2021-10-15T01:27:53-0400
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Weight:");
        double weight = in.nextDouble();
        System.out.println("Height:");
        double height = in.nextDouble();
        double bmi = weight / (height * height);
        System.out.println("BMI: " + bmi);
        System.out.println(bmi < 25 && bmi > 18.5 ? "Accepted" : "Not accepted");

    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS