Assignment #46 Age Message 3
Code
///Name: Ian Grant
///Period:5
///Project Name: Age Message 3
///File Name:AgeOldv3.java
///10/29/15
import java.util.Scanner;
public class AgeOldv3
{
public static void main(String[] args)
{
String name;
int age;
Scanner keyboard =new Scanner(System.in);
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);
}
else if((age > =16) && (age<=17))
{
System.out.println("You can drive but not vote,"+name);
}
else if((age>=18)&&(age<=24))
{
System.out.println("You can vote but not rent a car, "+name);
}
else if (age >=25)
{
System.out.println("You can do anything! "+name);
}
}
}
Output