HowOldAreYou

Code

import java.util.Scanner;

public class HowOldAreYou
{
	public static void main( String[] args )
	{
    
    int age;
    String name;
        
    Scanner keyboard = new Scanner(System.in);
    
    System.out.print( "whats your name? " );
    name = keyboard.next();
        
    System.out.print( "Ok, " + name + " how old are you? ");
    age = keyboard.nextInt();
        
    if ( age < 16)
    {
    System.out.print ( " You CAN'T DRIVE" + "            " );
    }
    if ( age > 16 && age < 18)
    {
    System.out.print( " YOU CAN DRIVE" + "            " );
    }
    else if ( age > 18 && age < 24)
    {
    System.out.print ( " YOU CAN VOTE BUT NOT RENT A CAR" + "            ");
    }
    else if ( age > 25 )
    {
    System.out.print ( " YOU CAN DO PRETTY MUCH ANYTHING " + "            ");
    }
    }
}

HowOldAreYou

Assignment 37