Created
October 15, 2020 17:10
-
-
Save helospark/e86d50eae33418b1d198c4ed5b77e560 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.helospark.bike; | |
/** | |
* Calculates the amount of calories & body fat burned from generated electric power in my exercise bike generator. | |
* @author helospark | |
*/ | |
public class ExerciseBikeWhToKcal { | |
static final int wh = 95; | |
public static void main(String[] args) { | |
final double muscleEfficiency = 0.2; | |
final double generatorEfficiency = 0.8; | |
final double kcalToWh = 1.163; | |
final double kcalPerKgOfFat = 7700; | |
double caloriesBurned = wh * (1.0 / kcalToWh) * (1.0 / muscleEfficiency) * (1.0 / generatorEfficiency); | |
double fatBurned = caloriesBurned / kcalPerKgOfFat; | |
System.out.printf("%.1f kcal\n", caloriesBurned); | |
System.out.printf("%.3f kg of fat burned\n", fatBurned); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment