Assignemnt #24 Age in Five Years
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Age in Five Years
///File Name: AiFY.java
///Date: 9/24/2015
import java.util.Scanner;
public class AiFY
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print( "Hello. What is your name? " );
name = keyboard.next();
System.out.print( "Hi " + name + "! How old are you? " );
age = keyboard.nextInt();
age = age + 5;
System.out.println( "Did you know that in five years you will be " + age + " years old?" );
age = age - 10;
System.out.println( "And five years ago you were " + age + " ! Imagine that!" );
}
}
Picture of the output