Assignemnt #24 and Age In Five Years
Code
///Name: Dakota Donahue
///Period: 5
///Project Name: AgeInFiveYears
///File Name: AgeInFiveYears
///Date: 9/21/2015
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main( String[] args)
{
String name;
int a, b, c;
Scanner keyboard = new Scanner(System.in);
System.out.print(" Hello. What is your name? ");
name= keyboard.next();
System.out.print(" Hi, " + name + "! How old are you? ");
a= keyboard.nextInt();
b= a-5;
c= a+5;
System.out.println(" Did you know that in five years you will be " + c + " years old? ");
System.out.println(" And 5 years ago you were " + b + " Imagine that! ");
}
}
Picture of the output