Age in 5 Years
import java.util.Scanner;
public class agein5years
{
public static void main( String[] args )
{
int age;
int ageplusfive;
int ageminusfive;
String name;
Scanner keyboard = new Scanner(System.in);
System.out.println( "Hey there. What's ur name?" );
name = keyboard.next();
System.out.println( "Hey " + name + ". How old r u?");
age = keyboard.nextInt();
ageplusfive = age + 5;
ageminusfive = age - 5;
System.out.println( "Did you know that in five years you'll be " + ageplusfive + " and that five years ago you were " + ageminusfive + "! Years flyin' by...");
}
}
Picture of the output