Question

In Java The following equations estimate the calories burned when exercising (source): Women: Calories = (...

In Java

The following equations estimate the calories burned when exercising (source):

Women: Calories = ( (Age x 0.074) — (Weight x 0.05741) + (Heart Rate x 0.4472) — 20.4022 ) x Time / 4.184

Men: Calories = ( (Age x 0.2017) + (Weight x 0.09036) + (Heart Rate x 0.6309) — 55.0969 ) x Time / 4.184

Write a program using inputs age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for women and men.

Output each floating-point value with two digits after the decimal point, which can be achieved as follows:
System.out.printf("%.2f", yourValue);

Ex: If the input is:

49 155 148 60

the output is:

Women: 580.94 calories
Men: 891.47 calories
0 0
Add a comment Improve this question Transcribed image text
Answer #1
import java.util.Scanner;

public class LabProgram {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        double age = in.nextDouble();
        double weight = in.nextDouble();
        double rate = in.nextDouble();
        double time = in.nextDouble();
        double women = (age * 0.074 - weight * 0.05741 + rate * 0.4472 - 20.4022) * time / 4.184;
        double men = (age * 0.2017 + weight * 0.09036 + rate * 0.6309 - 55.0969) * time / 4.184;
        System.out.printf("Women: %.2f calories\n", women);
        System.out.printf("Men: %.2f calories\n", men);
    }
}

Add a comment
Know the answer?
Add Answer to:
In Java The following equations estimate the calories burned when exercising (source): Women: Calories = (...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT