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