Assignment #24
Code
///Name: Jack Newsom
///Period: 5
///Program Name: AgeInFive
///Filename: AgeInFive.java
///Date Finished: 9/17/15
import java.util.Scanner;
public class AgeInFive
{
public static void main( String[] args )
{
Scanner fivebot = new Scanner(System.in);
String name;
int age, yAge, oAge;
System.out.println("Hello. What is your name?");
name = fivebot.next();
System.out.println("Hello, " + name +"! How old are you?");
age = fivebot.nextInt();
yAge = age - 5;
oAge = age + 5;
System.out.println("Did you know that in five years you will be " + oAge + " years old?");
System.out.println("And five years ago you were " + yAge + "! Imagine that!");
}
}
Picture of the output