/**
* Example to illustrate reading numbers from the keyboard
*
* @author Elizabeth Adams
* @version 1
*/
import java.util.Scanner;
import java.io.*;

public class ReadFromKeyboard_1a
{
   public static void main (String[] args) 
   {
      Scanner scan;
		int number;
		int count;
		
		// initialize count
		count = 0;
		
      // set Scanner to read from input stream		
		scan = new Scanner (System.in);

      // prommpt user to enter data
		System.out.println ("Please enter numbers you want this program to read ");
		System.out.println ("Enter a <ctrl-z> when you are done ");

      // Read and process each input line 
      while (scan.hasNext())
      {
         number = scan.nextInt();
               // echo input
         System.out.println (" got number " + number);
			++count;
      }
		
				// when out of data print ending message
      System.out.println 
		     (" read " + count + " numbers from keyboard - am now done ");

	}	
}
