samedi 22 février 2020

Calorie Counter Calculator for Computer Science 1

System.out.print("Your BMR is:");//BMR Calculation
        if (gender == ('M')){
            System.out.println(665+(6.23 * weight)+(12.7 * height)-(6.8 * age));

        } else if (gender == ('F')) {
            System.out.println(655+(4.35 * weight)+(4.7 * height)-(4.7 * age));

        };

I can get the result from the if-loop above to produce the BMR. However, I can't seem to get the BMR result to be input into the bottom if-loop to produce the exercise calculation.

System.out.println("What is your exercise routine, on the scale of 0 to 4? 0 is lowest and 4 is highest ");//Exercise Calculation
        int exercise = sc.nextInt();
        if (exercise == 0) {
            System.out.println(BMR * 1.2);
        } else if (exercise == 1) {
            System.out.println(BMR * 1.375);
        } else if (exercise == 2) {
            System.out.println(BMR * 1.55);
        } else if (exercise == 3) {
            System.out.println(BMR * 1.725);
        }else if (exercise == 4) {
            System.out.println(BMR * 1.9);
        };

Aucun commentaire:

Enregistrer un commentaire