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