Question: 2.27 LAB: Use constants (include formatting output to two decimal points) The following equations estimate the calories burned when exercising (source): Women: Calories = ((Age

2.27 LAB: Use constants (include formatting output to two decimal points) 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 input variables for age (years), weight (pounds), heart rate (beats per minute), and time (minutes), respectively. Output calories burned for both women and men based on the formulas above. Use a constant variable for each of following values: WOM_AGE_CONST = 0.074 WOM_WEIGHT_CONST = 0.05741 WOM_HEART_CONST = 0.4472 TIME_CONST = 4.184 MEN_AGE_CONST = 0.2017 MEN_WEIGHT_CONST = 0.09036 MEN_HEART_CONST = 0.6309 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 378290.2408682x3zqy7 LAB ACTIVITY 2.27.1: LAB: Use constants (include formatting output to two decimal points) 0 / 10 LabProgram.java Load default template. 1 import java.util.Scanner; 2 3 public class LabProgram { 4 public static void main(String[] args) { 5 6 /* Type your code here. */ 7 } 8} 9
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
