Assignemnt #46 Age Messages 3
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: Age Messegas 3
///File Name: AM3.java
///Date: 11/2/2015
import java.util.Scanner;
public class AM3
{
public static void main ( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int age;
String name;
System.out.println( "Hello, what is your name?");
name = keyboard.next();
System.out.println( "Okay " + name + ", how old are you?");
age = keyboard.nextInt();
if (age<16)
{
System.out.println( name + ", you can't drive.");
}
if (age>16 && age<17)
{
System.out.println( name + ", you can drive but not vote.");
}
if (age>17 && age<24)
{
System.out.println( name + ", you can vote but not rent a car.");
}
if (age>24)
{
System.out.println( name + ", you can do pretty much anything.");
}
}
}
Picture of the output