import java.util.Scanner;

/**********************************************************************
// Note: the acknowledgement section is not needed for labs
// Acknowledgements: ...
/**********************************************************************

/**********************************************************************
 * Class purpose: This class demonstrates the java loop
 * 
 * @author  Nancy Harris
 * @version V1 - 10/16/05
 *********************************************************************/

public class Count
{
   /******************************************************************
    * Function purpose: Main will be used to demonstrate loops 
    *
    * @param args Command line arguments, ignored
    *****************************************************************/
   public static void main(String [] args)
   {
		int 		max; 				// maximum number to count to or from		
		int 		counter;			// tracks the count
		Scanner 	stdin;			// standard input(keyboard)
		
		stdin = new Scanner(System.in);
		
		System.out.printf("Enter a positive integer: ");
		max = stdin.nextInt();
		System.out.printf("\n");
		
		//--------------------------------------------------
		// loop until we get a positive integer
		//--------------------------------------------------
		while (max <= 0)
		{
			System.out.printf("Bad value: %d\n", max);
			System.out.printf("Enter a positive integer: ");
			max = stdin.nextInt();
			System.out.printf("\n");
		}

		counter = 1;

		//--------------------------------------------------
		// loop until we count from 1 to max
		//--------------------------------------------------
		while (counter <= max)
		{
			System.out.printf("Counter: %d\n", counter);
			counter++;
		}
	}
}
