Assignemnt #35 and Else and If

Code

    /// Name: Kyle Ivy
    /// Period: 5
    /// Program Name: ElseIf
    /// File Name: ElseIf.java
    /// Date Finished: 10/22/2015
    
    public class ElseIf
    {
    	public static void main( String[] args )
    	{
    		int people = 30;
    		int cars = 40;
    		int buses = 15;
    
    		if ( cars > people )
    		{
    			System.out.println( "We should take the cars." );
    		}
    		else if ( cars < people )
    		{
    			System.out.println( "We should not take the cars." );
    		}
    		else
    		{
    			System.out.println( "We can't decide." );
    		}
    
    
    		if ( buses > cars )
    		{
    			System.out.println( "That's too many buses." );
    		}
    		else if ( buses < cars )
    		{
    			System.out.println( "Maybe we could take the buses." );
    		}
    		else
    		{
    			System.out.println( "We still can't decide." );
    		}
    
    
    		if ( people > buses )
    		{
    			System.out.println( "All right, let's just take the buses." );
    		}
    		else
    		{
    			System.out.println( "Fine, let's stay home then." );
    		}
    
    	}
    }
    
    /*
    1: The ELSE IF statement is only checked if the IF statement is false. If the ELSE IF is true it will be printed, and if not the ELSE statement is printed.
    2: Removing the ELSE from one of the ELSE IF statements doesn't change anything in this case, because if both IF statements are false it will still print 
    the ELSE statement. If one of the IF statements is true only that statement will be printed.
    */
    

prog35.PNG

Assignment 1