Programming Assignment #24
Code
/// Name: Dylan Sleeper
/// Period: 6
/// Program Name: Age in 5 years
/// File Name: ageFive.java
/// Date Finished: 10/22/2015
import java.util.Scanner;
public class ageFive{
public static void main(String[] args){
Scanner keyboard = new Scanner(System.in);
System.out.print("Hello. What is your name? ");
String name = keyboard.next();
System.out.println();
System.out.print("Hi, " + name + "! How old are you? ");
int age = keyboard.nextInt();
System.out.println();
System.out.println("Did you know that in five years you will be " + (age + 5) + " years old?");
System.out.println("And five years ago you were " + (age - 5) + "! Imagine that!");
}
}
Outputs