Assignemnt #42 Age Message 3
Code
///Name: JJ Deng
///Period: 11/19/15
///Program Name: Age Message 3
///File Name: AgeMessage3.java
///Date Finished: 11/19/20
import java.util.Scanner;
public class AgeMessage3
{
public static void main( String [] args )
{
Scanner keyboard = new Scanner(System.in);
String Name;
int Age;
System.out.println("Hey, What is your name?");
Name = keyboard.next();
System.out.println("Ok "+Name+", how old are you? (Sorry I keep forgetting) ");
Age = keyboard.nextInt();
if ( Age < 16 )
{
System.out.println("You can't drive, "+Name);
}
if ( Age >= 16 && Age <=17 )
{
System.out.println("You can drive but not vote,"+Name);
}
if ( Age >=18 && Age <= 24 )
{
System.out.println("You can vote but not rent a car,"+Name);
}
if ( Age >= 25 )
{
System.out.println("You can do anything legal now "+Name+", now go break some laws");
}
}
}
Picture of the output