
/**
 * @author Nancy Harris James Madison University
 *
 */
public class DukeFit 
{
	/**
	 * Entry point of the application
	 * @param args unused in this application
	 */
	public static void main(String[] args) 
	{
		// constants
			// there are no constants. None of these numbers has meaning
		
		// variables
		int age;
		int heartRate;
		int time;
		
		double weight;
		double menCaloriesBurned;
		double womenCaloriesBurned;
		
		String formatMen;
		String formatWomen;

		
		// create the io helper
		DukeFitIO helper = new DukeFitIO();
		helper = new DukeFitIO();
		
		// read in each of the values
		age = helper.enterAge();
		weight = helper.enterWeight();
		heartRate = helper.enterHeartRate();
		time = helper.enterTime();
		
		// calculate men's calories and women's calories
		menCaloriesBurned = calcCalories( "M", age, weight, heartRate, time);
		womenCaloriesBurned = calcCalories( "W", age, weight, heartRate, time);
		
		// format the result
		formatMen = String.format("%.2f", menCaloriesBurned);
		formatWomen = String.format("%.2f", womenCaloriesBurned);
		
		// output the result
		System.out.println(); // leave blank line
		
		helper.outputMen(formatMen);
		helper.outputWomen(formatWomen);
				
	}
	
	public static double calcCalories(String mw, int age, double weight, int heartRate,
		int time)
	{
		if (mw.equals("M"))
			return ((age * .2017) + (weight * .09036) + 
				(heartRate * .6309) - 55.0969) * time / 4.184;
		else
			return ((age * .074) + (weight * .05741) + 
					(heartRate * .4472) - 20.4022) * time / 4.184;	
	}
}
