Question
Java 1.01) One way to measure the amount of energy that is expended during exercise is to use metabolic equivalents (MET). Here are some METS
Java 1.01) 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: CaloriesjMinute = 0.0175 * MET * Weight 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.
this is my code
import java.text.DecimalFormat; class energy{ public static void main(String args[]){
//declaring important constants with MET values
final int running=10;//MET for running is 10,according to the question
final int basketball=8;//MET for basketball is 8,according to the question
final int sleeping=1;//MET for sleeping is 1,according to the question
int weight=150;//given that person weight is 150 pounds
double weight_in_kg;//for calculating weight in kilograms
weight_in_kg=weight/2.2;//1kg=2.2 pounds,based on that calculating kilogram value
double energy_running;//to store energy used for running
energy_running=0.0175*running*weight_in_kg*30;//calculating based on given formula,multiplying with 30,here 30 is minutes
double energy_basketball;//to store energy used for basketball
energy_basketball=0.0175*basketball*weight_in_kg*30;//calculating based on given formula,multiplying with 30,here 30 is minutes
double energy_sleeping;//to store energy used for sleeping
energy_sleeping=0.0175*sleeping*weight_in_kg*(6*60);//calculating based on given formula,multiplying with (6*60),here (6*60) is minutes
double total;//to store total number of calories
total=energy_running+energy_basketball+energy_sleeping;//adding all calculated energies,to get final amount of energy DecimalFormat formatter = new DecimalFormat(".###"); //to print upto 2 decimal places only System.out.print("total amount of energy used in terms of calories is :" + formatter.format(total)); } }
how do i correct this? It keeps giving me this in the my programming lab results section Problems Detected: The contents of your standard output is incorrect.
You displayed: instead of: Calories Burned: 1073.8636363636363
Failed 1 out of 1 test runs.
Failed Test Run
The contents of your standard output is incorrect.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started