Assignemnt #37
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: Thirty seventh Program
/// File Name: HowOld.java
/// Date Finished: 10/26/2015
import java.util.Scanner;
public class HowOld
{
public static void main(String[] args) {
Scanner keyboard = new Scanner(System.in);
String name;
int age;
System.out.print("Hey, what's your name? ");
name = keyboard.next();
System.out.print("Ok, " + name + ", how old are you? ");
age = keyboard.nextInt();
if ( age < 13 )
{
System.out.println("You are not a teenager yet.");
}
else if ( age > 16 )
{
System.out.println("You cant drive yet, bummer!");
}
else if ( age > 25 )
{
System.out.println("You are free to do anything your heart desires.");
}
else
{
System.out.println("You are 16 or older, congrats. Hope you got a sweet car.");
}
}
}
Picture of the output