Assignemnt #35 and Else And If

Code

/// Name: Tristan Chung
/// Period: 5
/// Program Name: ElseAndIf 
/// File Name: ElseAndIf.java
/// Date Finished: 10/23/2015

public class ElseAndIf
{
	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." );
		}
            /// The else if statements make it so if the if statement is not met it will read the else if statement, but if the else if statement requirement is not met, then it will read the else statement code. 

		if ( buses > cars )
		{
			System.out.println( "That's too many buses." );
		}
        if ( buses < cars )
		{
			System.out.println( "Maybe we could take the buses." );
		}
		else
		{
			System.out.println( "We still can't decide." );
		}
        // removing the else from line 33 doesnt change anything because the if statement's requirement is met and will thus perform the task within the curly brackets. 

		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

Assignment 35