Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

One way to measure the amount of energy (hat is expended during exercise is to u

ID: 3622981 • Letter: O

Question

One way to measure the amount of energy (hat is expended during exercise is to use metabolic equivalents (MET). Here are some METS for various activities: The number of calories burned per minute may be estimated using the formula: Calorics Minute = 0.0175 times MET times Weight in kilograms Write a Java program, named C248W2011A1_Q1 that calculates and outputs the total number of calories burned fora 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. Sample output screen: Welcome to the calorie calculator. A 150.0 lbs person: burned an estimated 357.95454545454544 Calories Running, burned an estimated 286.3636363636364 Calories playing basketball, and burned an estimated 429.5454545454545 Calories sleeping. Total Calories burned - 1073.8636363636363

Explanation / Answer

import java.util.*;

public class C248W2011A1_Q1
{
public static void main(String[] args)
{
// input mass
Scanner kb = new Scanner(System.in);
System.out.print("Enter the person's weight (lbs): ");
double weight = kb.nextDouble();

// find person's mass in kilograms
double mass = weight/2.2;

// calculations
double running = 0.0175*10*mass*30; // 10 MET, 30min
double basketball = 0.0175*8*mass*30; // 8 MET, 30min
double sleeping = 0.0175*1*mass*6*60; // 1 MET, 6hr
double total = running + basketball + sleeping;

// output
System.out.println("Welcome to the calorie calculator. A "+weight+" lbs person: ");
System.out.println(" burned an estimated "+running+" Calories running,");
System.out.println(" burned an estimated "+basketball+" Calories playing basketball, and");
System.out.println(" burned an estimated "+sleeping+" Calories sleeping. ");
System.out.println("Total calories burned: "+total);
}

}