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