Assignemnt #35

Code

/// Name: Connor Siri
/// Period: 7
/// Program Name: Else
/// File Name: Else.java
/// Date Finished: 10/1/2015
import java.util.Scanner;
class Else{

    public static void main(String[] args) {
    
        //the else if and else separate them from normal if's, else will only print if the else if is true
        // when a else is removed from the if it prints the else under it, it does this because without the else if it doesn't have an on and off switch so it just stays on 
        
    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

Assignment4.html