Assignment #33

Code

    /// Gian Adoremos
    /// Period: 7
    /// Program Name: ThirtyThird Program
    /// File Name: WhatIf.java
    /// Date Finished: 10/16/2015
   
   public class WhatIf
    {
    	public static void main( String[] args )
    	{
    		int people = 20;
    		int cats = 20;
    		int dogs = 15;
            
            //the parentheis make the statement run if its true
    
    		if ( people < cats ) 
    		{
    			System.out.println( "Too many cats!  The world is doomed!" ); 
    		}
            //people and cats are the same
    
    		if ( people > cats )
    		{
    			System.out.println( "Not many cats!  The world is saved!" );
    		}
            //people and cats are the same in value
    
    		if ( people < dogs )
    		{
    			System.out.println( "The world is drooled on!" );
    		}
            //the statement is false
    
    		if ( people > dogs )
    		{
    			System.out.println( "The world is dry!" );
    		}
            //prints because there are more people than dogs
    
    		dogs += 5;
    
    		if ( people >= dogs )
    		{
    			System.out.println( "People are greater than or equal to dogs." );
    		}
            //prints because the value contained in dogs int increased by 5
    
    		if ( people <= dogs )
    		{
    			System.out.println( "People are less than or equal to dogs." );
    		}
            //prints because people and dogs are now equal
    
    		if ( people == dogs )
    		{
    			System.out.println( "People are dogs." );
    		}
            //prints because the requirement is met
    	}
    }
 

Picture of the output

Assignment 33