
import java.util.Scanner;

/**
 * This class will provide IO services for the DukeFit application
 * 
 * @author Nancy Harris JMU
 * @version V1 - 09/2013
 *
 */
public class DukeFitIO 
{
	private Scanner input;
	
	/**
	 * The default constructor initializes the input Scanner
	 */
	public DukeFitIO() 
	{
		input = new Scanner(System.in);
	}
	/**
	 * Prompts the user for the age and then returns
	 * the result. Assumes the user correctly enters an integer.
	 * @return The person's age
	 */
	public int enterAge()
	{
		return enterInt("Enter the person's age: ");
	}
	/**
	 * This helper method prompts the user for a value
	 * and reads that value in from the keyboard.
	 * @param prompt the prompt to display
	 * @return the integer value the user entered
	 */
	private int enterInt(String prompt) 
	{
		int entry;
		
		System.out.print(prompt);
		entry = input.nextInt();
		
		System.out.println();
		return entry;
	}
	
	/**
	 * enterHeartRate prompts the user for the heart
	 * rate and reads it in from the keyboard.
	 * @return The heart rate for the person
	 */
	public int enterHeartRate()
	{
		return enterInt("Enter the person's heart rate: ");
	}
	/**
	 * enterTime prompts the user for the duration and 
	 * reads it in from the keyboard.
	 * 
	 * @return The duration of the activity in minutes
	 */
	public int enterTime()
	{
		return enterInt("Enter the duration of the activity: ");
	}
	/**
	 * enterWeight prompts the user for the person's weight and
	 * returns the value they enter in.
	 * 
	 * @return The weight in pounds
	 */
	public double enterWeight()
	{
		return enterDouble("Enter the person's weight: ");
	}
	/** enterDouble prompts the user for a value and 
	 * reads in that value from the keyboard.
	 * 
	 * @param prompt The prompt to display to the user
	 * @return The resulting value entered by the user
	 */
	/**
	 * @param prompt
	 * @return
	 */
	private double enterDouble(String prompt) {
		double entry;
		
		System.out.print(prompt);
		entry = input.nextDouble();
		
		System.out.println();
		return entry;
	}
	/**
	 * Outputs the number of calories for men based
	 * on the PA instructions.
	 * 
	 * @param calories The number of calories formatted
	 * according to PA instructions
	 */
	public void outputMen(String calories)
	{
		System.out.println("  Men: " + calories);
	}
	/**
	 * Outputs the number of calories for women based on the PA instructions.
	 * @param calories The number of calories formatted according to 
	 * PA instructions
	 */
	public void outputWomen(String calories)
	{
		System.out.println("Women: " + calories);
	}
}
