Assignment #34 and How Old Are You
Code
/// Name: Graham Pollock
/// Period: 5
/// Program Name: How Old Are You
/// File Name: HowOldAreYou.java
/// Date Finished: 10/16/2015/
import java.util.Scanner;
public class HowOldAreYou
{
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." );
}
if ( age < 18 )
{
System.out.println( "You Can't Vote." );
}
if ( age < 25 )
{
System.out.println( "You Can't Rent a Car." );
}
if ( age > 25 )
{
System.out.println( "You can do anything legal." );
}
}
}
Picture of the output