/**
 * An example that illustrates the use of the printf()
 * method in the JMUConsole class
 *
 * @author  Prof. David Bernstein, James Madison University
 * @version 1.0
 */
public class PrintfExample
{
    /**
     * The entry point of the application
     *
     * @param args   The command-line arguments
     */
    public static void main(String[] args)
    {
       int     age, weight;
       double  monday, tuesday, wednesday;
       
       age = 27;

       // Prepare the JMUConsole for input/output
       JMUConsole.open();       
       
       JMUConsole.printf("%d\n", age);
       JMUConsole.printf("%10d\n", age);
       
       weight = 155;
       
       JMUConsole.printf("Prof. B. is %d years old\n", age);
       JMUConsole.printf("Age: %d\tWeight: %d\n", age, weight);
       

       monday    =  35.8;
       tuesday   =   0.0;
       wednesday = -10.2;

       JMUConsole.println("\nWith No Flags, Width or Precision");       
       JMUConsole.printf("%f\n", monday);
       JMUConsole.printf("%f\n", tuesday);
       JMUConsole.printf("%f\n", wednesday);

       JMUConsole.println("\nWith No Flags");       
       JMUConsole.printf("%5.1f\n", monday);
       JMUConsole.printf("%5.1f\n", tuesday);
       JMUConsole.printf("%5.1f\n", wednesday);

       JMUConsole.println("\nWith + Flags");       
       JMUConsole.printf("%+5.1f\n", monday);
       JMUConsole.printf("%+5.1f\n", tuesday);
       JMUConsole.printf("%+5.1f\n", wednesday);

       // Close the JMUConsole
       JMUConsole.close();
    }
}
