/*
 *  Scanner Class
 *  Requires Java 1.5 (5.0)
 */ 

import java.util.Scanner; // program uses a library class, Scanner

public class ScannerDemo {
  public static void main (String args[])
  {
    int i;
    double fp;
    String str;

    // create new Scanner from command window
    Scanner input = new Scanner(System.in);

    System.out.print("Enter your name: ");
    str = input.nextLine();  // read a string from user (up to pressing <ENTER>)

    System.out.print("Enter your favorite integer: ");
    i = input.nextInt();  // read an integer from user
    
    System.out.print("Enter your favorite floating-point number: ");
    fp = input.nextDouble();  // read a double from user

    System.out.println(str+"'s favorite numbers are "+i+" and "+fp);
  }
}
