Assignemnt #46 Age Messages 3
Code
///Name: Joshua Pell
///Period: 6
///Project Name: Age Messages 3
///File Name: AgeMessages.java
///Date: 11/5/2015
import java.util.Scanner;
public class AgeMessages
{
public static void main(String[] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
System.out.println("What is your age?");
age = keyboard.nextInt();
if (age < 16)
{
System.out.println("You can't drive.");
}
if (age >= 16 && age < 18)
{
System.out.println("You can drive but not vote.");
}
if (age >= 18 && age < 25)
{
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