Assignemnt #30 How Old Are You?
Code
///Name: JJ Deng
///Period: 6
///Program Name: How Old Are You
///File Name: HowOldRU.java
///Date Finished: 10/14/15
import java.util.Scanner;
public class HowOldRU
{
public static void main( String[] args )
{
Scanner JJ = new Scanner(System.in);
String Name;
int Age;
System.out.println("Hey, What is your name?");
Name = JJ.next();
System.out.println("Ok "+Name+", how old are you?");
Age = JJ.nextInt();
if ( Age < 16 )
{
System.out.println("You can't drive, "+Name);
}
if ( Age < 18 )
{
System.out.println("You can't vote, "+Name);
}
if ( Age < 25 )
{
System.out.println("You can't 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