Keyboard Input #24 (Math is Kool)
Code
/// Name: Amir Salehi
/// Period: 7
/// Program name: AgeInFiveYears
/// File name: AgeInFiveYears.java
/// Date: Finished 10/1/2015
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main( String[] args )
{
String name ;
int age ;
Scanner keyboard = new Scanner(System.in);
System.out.println( "Hello. what is your name? " );
name = keyboard.next();
System.out.print( "Hi, " + name + "! " + "How old are you? ");
age = keyboard.nextInt();
System.out.print( "Did you know that in five years you will be " + (age + 5) + " years old?");
System.out.println( "And five years ago you were " + (age - 5) + "! " + "Imagine that!");
}
}
Picture of the output