Assignemnt #37, How Old Are You, Specifically?
Code
/// Name: Alex Pinder
/// Period: 5
/// Program Name: How Old Are You, Specifically?
/// File Name: prog37.java
/// Date Complete: 10/27/15
import java.util.Scanner;
public class prog37
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner( System.in);
int age;
System.out.print( "What is your age? " );
age = keyboard.nextInt();
if ( age < 16 )
{
System.out.println( "You can't drive." );
}
else if ( age > 15 )
{
if ( age < 18 )
{
System.out.println( "You can drive but not vote." );
}
else if ( age > 17 )
{
if ( age < 25 )
{
System.out.println( "You can vote but not rent a car." );
}
else if ( age > 24 )
{
System.out.println( "You can do pretty much anything." );
}
}
}
}
}
Picture of the output