Assignemnt #24
Code
/// Name: Daniel Nguyen
/// Period: 6
/// Program Name: AgeInFiveYears Program
/// File Name: ageinfiveyears.java
/// Date Finished: 9/9/2015
import java.util.Scanner;
public class ageinfiveyears
{
public static void main( String[] args )
{
String name;
int age;
Scanner keyboard = new Scanner(System.in);
System.out.print("Hello! What is your name? ");
name = keyboard.next();
System.out.print( "Hey " + name + "! How old are you? " );
age = keyboard.nextInt();
int older = age + 5;
int younger = age - 5;
System.out.print( "Did you know that in five years you will be " + older + " years old?" );
System.out.print( "And five years ago you were " + younger + "! Imagine that! " );
}
}
Picture of the output