Assignment #32

Code

/// Name: Kabir Virk
/// Period: 6
/// Program Name: WhatIf
/// File Name: WhatIf.java
/// Date Finished: 10/14/2015
   
   public class WhatIf
    {
    	public static void main( String[] args )
    	{
    		int people = 20;
    		int cats = 20;
    		int dogs = 15;
            
            //the curly braces make the statement run if its true
    
    		if ( people < cats ) 
    		{
    			System.out.println( "Too many cats!  The world is doomed!" ); 
    		}
            //people and cats are equal
    
    		if ( people > cats )
    		{
    			System.out.println( "Not many cats!  The world is saved!" );
    		}
            //people and cats are equal 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