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