Assignment #24 and Age In Five Years
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: Age In Five Years
/// File Name: AgeInFiveYears.java
/// Date Finished: 10/5/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.println( " " );
System.out.print( "Hello. What is your name? " ); name = keyboard.next();
System.out.println( " " );
System.out.println( "Hi, " + name + " How old are you? "); age = keyboard.nextInt();
System.out.println( " " );
System.out.println( name + ", 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) + " Years Old?");
System.out.println( " " );
System.out.println( " " );
}
}
Picture of the output