Assignemnt 24 and Age In Five Years
Code
/// Name: Xinting Chen
/// Period: 5
/// Program Name: Age In Five Years
/// File Name: AgeInFiveYears.java
/// Date Finished: 10/6/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( "Hi, " + Name + "!" );
System.out.print( "How old are you?" );
Age = keyboard.nextInt();
System.out.println( "Did you know that in five years you will be " + (Age+5) + "years old? ");
System.out.println( "And five years ago you were " + (Age-5) + " ! Imagine that!");
}
}
Picture of the output