Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Mission08Western {
- public static void main(String []args) {
- Scanner scan = new Scanner(System.in);
- System.out.print("Enter height in inches: ");
- double height = scan.nextDouble();
- while (height < 0.0) {
- System.out.print("Enter height in inches: ");
- height = scan.nextDouble();
- }
- System.out.print("Enter weight in inches: ");
- double weight = scan.nextDouble();
- while (weight < 0.0) {
- System.out.print("Enter weight in inches: ");
- weight = scan.nextDouble();
- }
- double BMI = (weight * 703) / (height * height);
- System.out.printf("Your BMI is %,.2f.\n", BMI);
- if (BMI < 18.5) {
- System.out.println("Your are underweight.\n");
- } else if (BMI >= 18.5 && BMI <= 24.9) {
- System.out.println("You have normal weight.\n");
- } else if (BMI >= 25 && BMI <= 29.9) {
- System.out.println("You are overweight!" +
- "\nTime to lose some pounds bruh!");
- } else if (BMI >= 30) {
- System.out.println("You are obese." +
- "\nPlease talk to your physician.");
- } else {
- System.exit(0);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement