Assignment #24
Code
/// Name: Jonathan Stine
/// Period: 5
/// Program Name: AgeInFive
/// File Name: AgeInFive.java
/// Date Finished: 10/6/2015
import java.util.Scanner;
public class AgeInFive
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age, age5Later, age5Before;
String name;
System.out.println( "Hello there! What is your name?" );
name = keyboard.next();
System.out.println("Hello " + name + "! How old are you?");
age = keyboard.nextInt();
age5Later = age + 5;
age5Before = age - 5;
System.out.println("Did you know that in 5 years you will be " + age5Later + " years old?");
System.out.println("And, 5 years ago you were " + age5Before + " years old! Imagine that!");
}
}
Code Output