Assignemnt #35 Else And If

Code

    ///Name: Morgan Kaplan
    ///Period: 5
    ///Project Name: Else And If
    ///File Name: ElseAndIf.java

public class ElseAndIf
{
	public static void main( String[] args )
	{
		// The else out prints a line when the option is anything different than what the if allows
        // Removing the else has no affect on the program
        
        int people =40;
		int cars = 30;
		int buses = 15;

		if ( cars > people )
		{
			System.out.println( "We should take the cars." );
		}
		 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 Output

Assignment 35