Assignemnt #46
Code
///Colin Hinton
///5th period
///Age Message
///AgeMessage.java
///10/15/2015
import java.util.Scanner;
class AgeMessage
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.print(" Your name: ");
name = keyboard.next();
System.out.print(" Your age: ");
age = keyboard.nextInt();
if (age < 16)
{
System.out.println(" You can't drive, " + name );
}
if ( 16 <= age && age <= 17)
{
System.out.println("You can drive but not vote, " + name );
}
if ( 18 <= age && age <= 24)
{
System.out.println("You can vote but not rent a car, " + name);
}
if ( 25 <= age)
{
System.out.println("You can do pretty much anything, " + name);
}
}
}
Picture of the output