Assignemnt #32
Code
///Colin Hinton
///5th Period
///If
///If.java
///9/28/2015
import java.util.Scanner;
class If
{
public static void main (String [] args)
{
Scanner keyboard = new Scanner(System.in);
int age;
System.out.print("How old are you?");
age = keyboard.nextInt();
if (age < 13)
{
System.out.println(" You are too younge for mySpace.");
}
if (age >= 13)
{
System.out.println(" You are old enough for mySpace.");
}
if (age < 16 )
{
System.out.println(" You are too young to drive.");
}
if (age >= 16)
{
System.out.println(" You are old enough to drive.");
}
if (age < 18)
{
System.out.println(" You are too younge to vote.");
}
if (age >= 18)
{
System.out.println(" You can vote.");
}
if (age < 21)
{
System.out.println(" You are too young to drink alcohol.");
}
if (age >= 21)
{
System.out.println(" You are old enough to drink alcohol.");
}
if (age < 35 )
{
System.out.println(" you are too young to run for president.");
}
if (age >= 35)
{
System.out.println(" you are old enough to run for president.");
}
if (age >= 65)
{
System.out.println("You are old enough to retire!");
}
}
}
Picture of the output