Prog 33: What If
///Name: Ilana Levy
///Period: 5
///Project Name: What If
///File Name: whatIf.java
///Date finished: 9/9/2015
import java.util.Scanner;
public class whatIf
{
public static void main( String[] args)
{
int people = 20;
int cats = 20;
int dogs = 15;
if ( people < cats )
{
System.out.println( "Too many cats! The world is doomed!" );
}
if (people > cats)
{
System.out.println( "Not many cats! The world is saved!" );
}
if (people < dogs )
{
System.out.println( "THe world is drooled on!" );
}
if ( people >= dogs )
{
System.out.println( "People are greater than or equal to dogs." );
}
if ( people <= dogs )
{
System.out.println( "People are less than or equal to dogs." );
}
if ( people == dogs )
{
System.out.println( "People are dogs." );
}
}
}
/// the if statement creates a conditional circumstance in which certain criteria must be met for certain outcomes to be printed.
/// the curly braces tell the computer that the program should be run based on information in the if statement above; the code inside the brackets is inaccessible if the if statement if false. Otherwise, the same code would print every time.