Assignemnt #22 Name, Age and Salary

Code

    Name: Iaroslav Titov
    Period: 7
    Project Name: Questions
    File Name: Questions.java
    Date: 9/22/2015
    
import java.util.Scanner;
import java.util.InputMismatchException;

public class Questions
{
    public static void main (String[] args)
    {
        Scanner keyboard = new Scanner(System.in);
        
        String name;
        int age;
        double income;
        
        try 
        {
            System.out.print( "What is your name, human? " );
            name = keyboard.next();
 
            System.out.print( "Greetings, " + name + "! How many years did you survive so far? " );
            age = keyboard.nextInt();
 
            System.out.println("So  " + age + " years, eh? Impressive, human. " );
 
            System.out.print( "Finally, what's your income, " + name + "? " );
            income = keyboard.nextDouble();
 
            System.out.println( "Hopefully that is " + income + " per hour and not per millenia!" );
            System.out.println( "Well, thanks for answering my weird alien questions, " + name + "." );
        }
        catch (InputMismatchException e)
        {
            System.out.println( "WRONG INPUT!!!" );
        }
        
    }
}
    

Picture of the output

Assignment 19