Assignment #46 Age Message 3
Code
/// Name: Matthew Lorence
/// Period: 5
/// Program Name: AgeMessages3
/// File Name: AgeMessages3.java
/// Date Finished:12/03/15
import java.util.Scanner;
public class AgeMessages3
{
public static void main (String[] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.println("Your name: ");
name = keyboard.next();
System.out.println("Your age :");
age = keyboard.nextInt();
if ( age < 16 )
{
System.out.println("You can't drive.");
}
if ( age >= 16 && age <=17 )
{
System.out.println("You can drive but not vote.");
}
if ( age >= 18 && age <=24 )
{
System.out.println("You can vote but not rent a car.");
}
if ( age > 25 )
{
System.out.println("You can do pretty much anything.");
}
}
}
Picture of the output