Assignemnt #24: Your Age in Five Years

Code

 /// Name: Sean Harrison
    /// Period: 7
    /// Program name: Age in 5 years
    /// File Name: AgeInFiveYears.java
    /// Date Finished: 9/29/2015
    
import java.util.Scanner;
public class AgeInFiveYears
{
public static void main( String[] args )
    {
        int age;
        String name;
        
            Scanner keyboard = new Scanner(System.in);
        
        System.out.println( "Hello. What is your name? " );
        name = keyboard.next();
        System.out.println();
    
        System.out.println( "Hi, " + name + "! How old are you? " );
        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! " );
    }
}


 

Picture of the output

Assignment 24