Assignment #24

Code

    ///Name: Cody Swain
    ///Period: 6
    ///Project Name: AgeFiveYears
    ///File Name: AgeFiveYears.java
    ///Date: 9/30/15
    
    import java.util.Scanner;
    
    public class AgeFiveYears
    {
        public static void main( String[] args )
        {
            String name;
            int age;
            int laterAge;
            int earlierAge;
            
            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? " );
            age = keyboard.nextInt();
            laterAge = age+5;
            earlierAge = age-5;
            
            System.out.println( "Did you know that in five years you will be " + laterAge + " years old? ");
            System.out.println( "And five years ago you were " + earlierAge + "! Imagine that!" );
            
        }
    }

    
    

Picture of the output

Assignment 24