One way to measure the amount of energy that is expended during exercise is to use metabolic equivalents (MET). Here are some METS for various activities: Running 6 MPH: 10 METS
Basketball: 8 METS
Sleeping: 1 MET
The number of calories burned per minute may be estimated using the following formula:
in kilograms
Write a program that calculates and outputs the total number of calories burned for a 150-pound person who runs 6 MPH for 30 minutes, plays basketball for 30 minutes, and then sleeps for 6 hours. One kilogram is equal to 2.2 pounds.
Program:
// CaloriesCalculator.java
public class CaloriesCalculator
{
public static final double KILOGRAMS_PER_POUND = 2.2;
public static final int RUNNING_METS = 10;
public static final int BASKETBALL_METS = 8;
public static final int SLEEPING_METS = 1;
public static void main(String[] args)
{
double weightInKilograms = 150 / KILOGRAMS_PER_POUND;
double runningTimeInMinutes = 30;
double basketballTimeInMinutes = 30;
double sleepintTimeInMinutes = 6 * 60;
double caloriesBurnedForRunning = 0.0175
* RUNNING_METS * weightInKilograms
* runningTimeInMinutes;
double caloriesBurnedForBasketball = 0.0175
* BASKETBALL_METS * weightInKilograms
* basketballTimeInMinutes;
double caloriesBurnedForSleeping = 0.0175
* SLEEPING_METS * weightInKilograms
* sleepintTimeInMinutes;
double totalCaloriesBurned = caloriesBurnedForRunning
+ caloriesBurnedForBasketball
+ caloriesBurnedForSleeping;
System.out.println(
"Number of calories burned for running: "
+ caloriesBurnedForRunning);
System.out.println(
"Number of calories burned for basketball: "
+ caloriesBurnedForBasketball);
System.out.println(
"Number of calories burned for sleeping: "
+ caloriesBurnedForSleeping);
System.out.println(
"\nTotal number of calories burned per minute: "
+ totalCaloriesBurned);
}
}
Output:
Number of calories burned for running: 357.95454545454544
Number of calories burned for basketball: 286.3636363636364
Number of calories burned for sleeping: 429.5454545454545
Total number of calories burned per minute: 1073.8636363636363
Thanks for your great help. Awesome free sevice
**Anne is using a calorie tracker app that helps her keep a record of all her physical activities and her daily intake of calories**
**The calories burned by her doing some of the common physical activities are:**
1. 30 minutes of cycling burns around 300 calories
2. 30 minutes of swimming burns around 200 calories
3. 30 minutes of running burns around 500 calories
**Anne can lose one pound of weight for each 1000 calories burned. Her daily extra calorie intake tracked by the app is 100**
**Write a java program to calculate the number of pounds Anne can lose in a month if she does each of the above mentioned activities
once a week for 1 hour and chooses to do one activity per day.**
**Sample Input:**
Calorie burnt by cycling : 200
Calorie burnt by running : 200
Calorie burnt by swimming: 200
Calorie intake in a day : 100
**Sample Output:**
Weight lost by Anne in a month is : 5.0 pounds
Post the discussion to improve the above solution.