Assignemnt #21
Code
/// Name: Sam Wilson
/// Period: 6
/// Program Name: age_five
/// File Name: age_five.java
/// Date Finished: 10/2/2015
import java.util.Scanner;
public class age_five
{
public static void main( String[] args )
{
String firstName, lastName;
int age;
Scanner keyboard = new Scanner(System.in);
System.out.print("Hello What is your first name? ");
firstName = keyboard.next();
System.out.print("What is your last name? ");
lastName = keyboard.next();
System.out.println();
System.out.println("Hi, " +firstName+ " " +lastName+ "! 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