Assignemnt #34 and How old are you?
Code
/// Name: Mark Katz
/// Period: 6
/// Program Name: How Old are You?
/// File Name: Age.java
/// Date Finished: 9/24/15
import java.util.Scanner;
public class Age
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.println( "What's your name?" );
name =keyboard.next();
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, " + name + "");
}
if ( age < 25 )
{
System.out.println( "You can't rent a car, " + name + "");
}
if ( age > 25 )
{
System.out.println( "You can do anything that's legal, " + name + "");
}
}
}
Picture of the output