Created
October 15, 2020 17:11
-
-
Save helospark/6b0e92d01b92b4fae28365e83c3a8eeb 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 how many watts I have to generate to burn the amount of calories on my exercise bike generator. | |
* @author helospark | |
*/ | |
public class ExerciseBikeKcalToWh { | |
static final int kcalEaten = 640; | |
public static void main(String[] args) { | |
final double muscleEfficiency = 0.2; | |
final double generatorEfficiency = 0.8; | |
final double kcalToWh = 1.163; | |
final double avgWatts = 100.0; | |
double whGenerated = kcalEaten * (kcalToWh * muscleEfficiency * generatorEfficiency); | |
double timeToGenerate = whGenerated / avgWatts; | |
System.out.printf("%.2f Wh\n", whGenerated); | |
System.out.printf("%d min\n", (int) (timeToGenerate * 60)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment