Assignemnt #37
Code
/// Name: Connor Siri
/// Period: 7
/// Program Name: How
/// File Name: How.java
/// Date Finished: 10/2/2015
import java.util.Scanner;
class How{
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 < 15 )
{
System.out.println("You are not half way to 30 yet.");
}
else if ( age < 21 )
{
System.out.println("You can't drink yet");
}
else
{
System.out.println("You are over 15 yay.");
}
}
}
Picture of the output