Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *BMI Project
- *
- * Zain Arfi
- * @version (a version number or a date)
- */
- import java.util.*;
- public class BMI_Project
- {
- public static void main(String[] args)
- {
- Scanner console = new Scanner(System.in);
- System.out.println("What is person one's height in inches?");
- int height1 = console.nextInt();
- System.out.println("What is person two's height in inches");
- int height2 = console.nextInt();
- System.out.println("What is person one's weight in pounds?");
- int weight1 = console.nextInt();
- System.out.println("What is person two's weight in pounds?");
- Calculate(height1, height2, weight1, weight2);
- }
- public static string Calculate(int h1, int h2, int w1, int w2)
- {
- double Bmi1 = w1 / (h1 * h1) * 703;
- double Bmi2 = w2 / (h2 * h2) * 703;
- double diff = Math.abs(Bmi1 - Bmi2);
- return(
- if((Bmi1 >= 30))
- {
- System.out.println("Person 1 BMI =" + Bmi1);
- System.out.println("obese");
- }
- else if((Bmi1 >= 25) && (Bmi1 <= 29.9))
- {
- System.out.println("Person 1 BMI =" + Bmi1);
- System.out.println("overweight");
- }
- else if((Bmi1 >=18.5) && (Bmi1 <= 24.9))
- {
- System.out.println("Person 1 BMI =" + Bmi1);
- System.out.println("normal");
- }
- else if((Bmi1 <= 18.5))
- {
- System.out.println("Person 1 BMI =" + Bmi1);
- System.out.println("underweight");
- }
- else if((Bmi2 >= 30))
- {
- System.out.println("Person 2 BMI =" + Bmi1);
- System.out.println("obese");
- }
- else if((Bmi2 >= 25) && (Bmi2 <= 29.9))
- {
- System.out.println("Person 2 BMI =" + Bmi1);
- System.out.println("overweight");
- }
- else if((Bmi2 >=18.5) && (Bmi2 <= 24.9))
- {
- System.out.println("Person 2 BMI =" + Bmi1);
- System.out.println("normal");
- }
- else if(Bmi2 <= 18.5)
- {
- System.out.println("Person 2 BMI =" + Bmi1);
- System.out.println("underweight");
- }
- System.out.println("Difference =" + diff);
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement