/**
* Code illustrating problem how to fix the
* problem that occurs when trying to obtain a String
* from the keyboard after "enter" has been
* pressed if the order of the data to be obtained
* can NOT be altered. 
*
* This is the example we played with in class where I was
* the 105 year old woman earning a million a year
*
* @author ???? - modified by Elizabeth Adams
* @version ???? - September 5, 20008
*/

import java.util.Scanner; 
public class InputProblemAvoided
{
 
public static void main(String[] args)
  {
      String name;   
     
int age;      
     
double income;      
      Scanner keyboard;
                   
      keyboard =
new Scanner(System.in);
           
      System.out.print(
"What is your age? ");
      age = keyboard.nextInt();
            
      System.out.print(
"What is your annual income? ");
      income = keyboard.nextDouble();
           
      keyboard.nextLine();
// add this line to bypass
        // the carriage return line-feed that was in
        // the way.
      System.out.print("What is your name? ");
      name = keyboard.nextLine();
     
      System.out.println
         (
"Hello " + name + ". Your age is " + age +
                   
" and your income is $" +  income);
   }
// end main
} // end class