/* * [Bath.java] * * Summary: calculate how long it takes for a hot water heater to heat water. * * Copyright: (c) 2009-2017 Roedy Green, Canadian Mind Products, http://mindprod.com * * Licence: This software may be copied and used freely for any purpose but military. * http://mindprod.com/contact/nonmil.html * * Requires: JDK 1.8+ * * Created with: JetBrains IntelliJ IDEA IDE http://www.jetbrains.com/idea/ * * Version History: * 1.0 2010-12-05 initial version */ package com.mindprod.test; import static java.lang.System.*; /** * calculate how long it takes for a hot water heater to heat water. * * @author Roedy Green, Canadian Mind Products * @version 1.0 2010-12-05 initial version * @since 2010-12-05 */ public class Bath { /** * calculate how long it takes for a hot water heater to heat water * * @param args [0] rating of hot water heater in watts. * [1] US gallons of water to heat * [2] degrees Fahrenheit to heat water to */ public static void main( String[] args ) { final double watts = Double.parseDouble( args[ 0 ] ); // rating of heater in watts final double g = Double.parseDouble( args[ 1 ] ); // us gallons final double f = Double.parseDouble( args[ 2 ] ); // temp of water in degrees F final double c = ( f - 32 ) * 5. / 9.; // temp of water C , also rise from 0 final double l = g * 3.78541178; // liters final double kcal = c * l; // kcal final double kj = kcal * 4.1867999409; // kjoules final double seconds = kj * 1000 / watts; final double minutes = seconds / 60; out.println( "watts:" + watts + " g:" + g + " f:" + f ); out.println( "c:" + c + " l:" + l + " kj:" + kj ); out.println( "minutes:" + minutes + " seconds:" + seconds ); } }