Assignment 35: Else And If

Code

     /// Name: Ryan McAteer
    /// Period: 5
    /// Program Name: Else And If
    /// File Name: Assignment35.java
    /// Date Finished: 10/5/15

class Assignment35 
{
      public static void main(String[] args) 
      {
            //1) Else if is a specific command for when another condition is met other than that of the if statement.//
            //   The else is if both the if and else if conditions are not met.//
            //2) Removing the else will not do anything if the conditons (number of cars/buses/people) are met//
          
        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." );
		    }

	    }
}
           
           
           

           
           
    

Picture of the output

This should work