Assignemnt #24: Age In Five Years
Code
/// Name: Kelsey Lieberman
/// Period 5
/// Program Name: AgeInFiveYears
/// File Name: AgeInFiveYears.java
/// Date Finished: 10/2/2015
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.print("Hello, what is your name? ");
name = keyboard.next();
System.out.print("Hi, " + name + ", nice to meet you. How old are you? ");
age = keyboard.nextInt();
System.out.println("Wow you are " + age + "??? \nDid you know that in 5 years you will be " + (age + 5) + "?!\nAnd 5 years ago you were " + (age - 5) + "! Crazy.");
}
}
Picture of the output