Assignemnt #37 How Old Are You, Specifically
Code
///Tyler Hart
///period 5
///How Old Are You, Specifically
///HowOld.java
///10/1/2015
import java.util.Scanner;
public class HowOld
{
public static void main( String[] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
System.out.println( "How old are you?" );
age = keyboard.nextInt();
if (age < 16)
{
System.out.println( "You can't drive." );
}
else if (age <= 17)
{
System.out.println( "You can drive but not vote." );
}
else if (age <= 24)
{
System.out.println( "You can vote but not rent a car." );
}
if (age >= 25)
{
System.out.println( "You can do pretty much anything." );
}
}
}
Picture of the output