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