1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- public class BMR {
-
- public static void main(String[] args) {
- java.util.Scanner input = new java.util.Scanner(System.in);
- String name;
- String gender;
- int age;
- int heightInches;
- int weightPounds;
- double heightCm;
- double weightKg;
- double BMR;
- System.out.print("Enter your name: ");
- name = input.nextLine();
- System.out.print("Gender (M or F): ");
- gender = input.next();
- System.out.print("Enter your age: ");
- age = input.nextInt();
- System.out.print("Height in inches: ");
- heightInches = input.nextInt();
- System.out.print("Weight in pounds: ");
- weightPounds = input.nextInt();
- heightCm = heightInches * 2.54;
- weightKg = weightPounds * 0.45359237;
- BMR = 10 * weightKg + 6.25 * heightCm;
- if(gender.toUpperCase() == "M")
- BMR += 5;
- else
- BMR -= 161;
- System.out.println("Name: " + name);
- System.out.println("Gender:" + gender);
- System.out.println("Age: " + age);
- System.out.println("Weight (kg): " + weightKg);
- System.out.println("Height (cm): " + heightCm);
- System.out.println("Basal Metabolic Rate: " + BMR + " calories per day");
- }
-
- }
|