Assignemnt #24 and Age in Five Years
Code
///Name: Ben Borglin
///Period: 6
///Program Name: Age In Five Years
///File Name: AgeInFiveYears.java
///Date Finished: 9/21/15
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main( String[] args )
{
String name;
double age, add5, sub5;
Scanner keyboard = new Scanner(System.in);
System.out.print("Hello. What's your name? " );
name = keyboard.next();
System.out.print("Hi, " + name + "! How old are you? " );
age = keyboard.nextDouble();
add5 = age+5;
System.out.print("Did you know that in five years you will be " + add5 + " years old?");
sub5 = age-5;
System.out.print("And five years ago you were " + sub5 + "! Imagine that!");
}
}
Picture of the output