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