Code
/// Name: Afaf Nabeeha
/// Period: 7
/// Program Name: How Old are You, Specifically?
/// File Name: HowOld.java
/// Date Finished: 10/23/2015 public class HowOld
import java.util.Scanner;
public class HowOld
{
public static void main( String [] args )
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.print( "Hey, what's your name? (Sorry, I keep forgetting.) " );
name = keyboard.next();
System.out.print( "Ok, " + name + ", how old are you? " );
age = keyboard.nextInt();
if ( age < 16 )
{
System.out.println( "You can't drive, " + name );
}
else if ( 16 <= age)
{
System.out.println( "You can drive but not vote, " + name );
}
else if ( 18 <= age )
{
System.out.println( "You can vote but not rent a car, " + name );
}
else if ( 25 <= age )
{
System.out.println( "You can pretty much do anything, " + name );
}
}
}
Picture of the output