Assignemnt #37 How Old Are You, Specifically?
Code
///Name: Prooz Fereydouni
///Period: 7
///Project Name: How Old Are You, Specifically?
///File Name: HOAYS.java
///Date: 10/22/2015
import java.util.Scanner;
public class HOAYS
{
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.");
}
else if (age<17)
{
System.out.println( name + ", you can drive but not vote.");
}
else if (age<24)
{
System.out.println( name + ", you can vote but not rent a car.");
}
else
{
System.out.println( name + ", you can do pretty much anything.");
}
}
}
Picture of the output