Assignemnt #24 Age In Five Years
Code
/// Name: Jake Johnson
/// Period: 7
/// Program Name: AgeInFiveYears
/// File Name: AgeInFiveYears.java
/// Date Finished: 9/21/2015
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main( String[] args)
{
String name;
int age, ageFuture, agePast;
Scanner keyboard = new Scanner(System.in);
System.out.print("Hello. What is your name? ");
name = keyboard.next();
System.out.println("");
System.out.print("Hi, " + name + " How old are you? " );
age = keyboard.nextInt();
ageFuture = age + 5;
agePast = age - 5;
System.out.println("");
System.out.println("Did you know that in 5 years you will be " + ageFuture + " years old?");
System.out.println("And five years ago you were " + agePast + "! Imagine that!");
}
}
Picture of the output