Assignment #24
Code
///Name:Mahima Choudhary
///Period: 6
///Project Name: AgeInFiveYears
///File Name: AgeInFiveYears
///Date Finished: 10/5/15
import java.util.Scanner;
public class AgeInFiveYears {
public static void main( String[] args ) {
Scanner keyboard = new Scanner(System.in);
String name;
int age, agePlus5, ageMinus5;
System.out.print( "Hello. What is your name? " );
name = keyboard.next();
System.out.print( "\nHi, " + name + "! How old are you? " );
age = keyboard.nextInt();
agePlus5 = age + 5;
ageMinus5 = age - 5;
System.out.println( "\nDid you know that in five years you will be " + agePlus5 + " years old?" );
System.out.println( "And five years ago you were " + ageMinus5 + "! Imagine that!" );
}
}
Picture of the output