Assignemnt #24 and Age In 5 Years
Code
///Name: Daniel Tiffany-Appleton
///Period: 7
///Program Name: Age In 5 Years
///File Name: AgeIn5Years
///Date Finished: 9/24/15
import java.util.Scanner;
public class AgeIn5Years
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
String nameFirstAndLast;
int age, agePlus5, ageMinus5;
System.out.print( "Hello. What is your name? " );
nameFirstAndLast = keyboard.next();
System.out.print( "Hi, " + nameFirstAndLast + "! How old are you? " );
age = keyboard.nextInt();
agePlus5 = (age + 5);
System.out.println( "Did you know that in five years you will be " + agePlus5 + " years old?" );
ageMinus5 = age - 5;
System.out.println( "And five years ago you were " + ageMinus5 + "! Imagine that!" );
}
}
Picture of the output