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