/**
 * An example that illustrates the use of the JMUConsole class
 * for (output and) input.
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class InputExample
{
    /**
     * The entry point of the application
     *
     * @param args   The command-line arguments
     */
    public static void main(String[] args)
    {
        double  weight;
        
        int     age;

        // Prepare the JMUConsole for input/output
        JMUConsole.open();       
       
        // Prompt the user for her/his age
        JMUConsole.print("Enter your age (in years): ");
       
        // Read the response
        age = JMUConsole.nextInt();
       
        // Prompt the user for her/his weight and read the response
        JMUConsole.print("Enter your weight (in pounds): ");
        weight = JMUConsole.nextDouble();        

        // Echo the responses
        JMUConsole.printf("You are %d years old and weight %5.1f pounds.\n", 
                          age, weight);

        // Close the JMUConsole
        JMUConsole.close();
    }
}
