Assignemnt #24
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: twenty fourth Program
/// File Name: AgeIn5Years.java
/// Date Finished: 9/30/2015
import java.util.Scanner;
public class AgeIn5Years
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age, age1, age2;
String name;
System.out.print( "Hello. What is you name? " );
name = keyboard.next();
System.out.print( "Hi " + name + "! How old are you " );
age = keyboard.nextInt();
age1 = age + 5;
age2 = age - 5;
System.out.println( "Did you know that in five years you will be " + age1 + " years old? " );
System.out.println( "Did you know that five years ago you were " + age2 + " Imagine that! " );
}
}
Picture of the output